
---Made by: KevAK---

---CHEMMOD V1.2B Made in April, 2017.---

---Please report any bug or error.---



print(" OCHEM-MOD V 2.0.0 By Kev AK        ")
print(" Organic and Inorganic Chemistry!  ")
print(" I wish you have fun.              ")
print("-----------------------------------")
print(" RAD-MOD Compatible Version        ")

-----GASES-------------------------------------------------------------------------------------------------------------------
local nitrogen = elem.allocate("KEV", "N2")
local nitrogenoxide = elem.allocate("KEV", "N2O")
local ozone = elem.allocate("KEV", "O3")
local ammonia = elem.allocate("KEV", "NH3")
local nitromethane = elem.allocate("KEV", "CH3NO")
local methane = elem.allocate("KEV", "CH4")
local carbonmonoxide = elem.allocate("KEV", "CO")
local hydrazine = elem.allocate("KEV", "N2H4")
local tetracloromethane = elem.allocate("KEV", "R32")
local sulfuroxide = elem.allocate("KEV", "S2O")
local chlorine = elem.allocate("KEV", "CL")
local iodinevapor = elem.allocate("KEV", "IODV")
elem.element(elements.KEV_PT_N2, elem.element(elem.DEFAULT_PT_WTRV))
elem.element(elements.KEV_PT_N2O, elem.element(elem.DEFAULT_PT_WTRV))
elem.element(elements.KEV_PT_O3, elem.element(elem.DEFAULT_PT_WTRV))
elem.element(elements.KEV_PT_NH3, elem.element(elem.DEFAULT_PT_WTRV))
elem.element(elements.KEV_PT_CH3NO, elem.element(elem.DEFAULT_PT_WTRV))
elem.element(elements.KEV_PT_CH4, elem.element(elem.DEFAULT_PT_WTRV))
elem.element(elements.KEV_PT_CO, elem.element(elem.DEFAULT_PT_WTRV))
elem.element(elements.KEV_PT_N2H4, elem.element(elem.DEFAULT_PT_WTRV))
elem.element(elements.KEV_PT_R32, elem.element(elem.DEFAULT_PT_BOYL))
elem.element(elements.KEV_PT_S2O, elem.element(elem.DEFAULT_PT_WTRV))
elem.element(elements.KEV_PT_CL, elem.element(elem.DEFAULT_PT_WTRV))
elem.element(iodinevapor, elem.element(elem.DEFAULT_PT_BOYL))
elem.property(elements.KEV_PT_N2, "Name", "N2")
elem.property(elements.KEV_PT_N2O, "Name", "N2O")
elem.property(elements.KEV_PT_O3, "Name", "O3")
elem.property(elements.KEV_PT_NH3, "Name", "NH3")
elem.property(elements.KEV_PT_CH3NO, "Name", "CH3NO")
elem.property(elements.KEV_PT_CH4, "Name", "CH4")
elem.property(elements.KEV_PT_CO, "Name", "CO")
elem.property(elements.KEV_PT_N2H4, "Name", "N2H4")
elem.property(elements.KEV_PT_R32, "Name", "R-32")
elem.property(elements.KEV_PT_S2O, "Name", "S2O")
elem.property(elements.KEV_PT_CL, "Name", "CL")
elem.property(iodinevapor, "Name", "IODV")
elem.property(elements.KEV_PT_N2, "Description", "Nitrogen. Basic for life.")
elem.property(elements.KEV_PT_N2O, "Description", "Nitrous Oxide. Explosive, try to mix it with WATR.")
elem.property(elements.KEV_PT_O3, "Description", "Ozone. An comburent oxygen isotope.")
elem.property(elements.KEV_PT_NH3, "Description", "Amoniac. Caustic but useful.")
elem.property(elements.KEV_PT_CH3NO, "Description", "Nitromethane. Highly sensitive explosive, hard to be synthetized.")
elem.property(elements.KEV_PT_CH4, "Description", "Methane. Burns easily. Explodes in contact with other gases.")
elem.property(elements.KEV_PT_CO, "Description", "Carbon Monoxide. Flammable and low reactive.")
elem.property(elements.KEV_PT_N2H4, "Description", "Hydrazine. Very reactive combustible, slowly descomposes into HYGN.")
elem.property(elements.KEV_PT_R32, "Description", "Difluoromethane. Freon 32. Refrigerant.")
elem.property(elements.KEV_PT_S2O, "Description", "Sulfur Monoxide. Smells bad but useful.")
elem.property(elements.KEV_PT_CL, "Description", "Chlorine. Corrosive and toxic.")
elem.property(iodinevapor, "Description", "Iodine Vapor. As a tip it´s the best way to make NI3.")
elem.property(elements.KEV_PT_N2, "Color", 0x2DCB99)
elem.property(elements.KEV_PT_N2O, "Color", 0x29CED0)
elem.property(elements.KEV_PT_O3, "Color", 0xAEEEEE)
elem.property(elements.KEV_PT_NH3, "Color", 0xB4EEB4)
elem.property(elements.KEV_PT_CH3NO, "Color", 0xD1D1D1)
elem.property(elements.KEV_PT_CH4, "Color", 0xE6E6FA)
elem.property(elements.KEV_PT_CO, "Color", 0x808080)
elem.property(elements.KEV_PT_N2H4, "Color", 0x8DB6CD)
elem.property(elements.KEV_PT_R32, "Color", 0xFFC125)
elem.property(elements.KEV_PT_S2O, "Color", 0xFA8073)
elem.property(elements.KEV_PT_CL, "Color", 0xA0FA9B)
elem.property(iodinevapor, "Color", 0xC40470)
elem.property(elements.KEV_PT_N2, "Flammable", 0)
elem.property(elements.KEV_PT_N2O, "Flammable", 350)
elem.property(elements.KEV_PT_O3, "Flammable", 0)
elem.property(elements.KEV_PT_NH3, "Flammable", 750)
elem.property(elements.KEV_PT_CH3NO, "Flammable", 790)
elem.property(elements.KEV_PT_CH4, "Flammable", 780)
elem.property(elements.KEV_PT_CO, "Flammable", 125)
elem.property(elements.KEV_PT_N2H4, "Flammable", 1450)
elem.property(elements.KEV_PT_R32, "Flammable", 0)
elem.property(elements.KEV_PT_S2O, "Flammable", 0)
elem.property(elements.KEV_PT_CL, "Flammable", 0)
elem.property(iodinevapor, "Flammable", 0)
elem.property(elements.KEV_PT_N2, "Explosive", 0)
elem.property(elements.KEV_PT_N2O, "Explosive", 300)
elem.property(elements.KEV_PT_O3, "Explosive", 0)
elem.property(elements.KEV_PT_NH3, "Explosive", 750)
elem.property(elements.KEV_PT_CH3NO, "Explosive", 950)
elem.property(elements.KEV_PT_CH4, "Explosive", 900)
elem.property(elements.KEV_PT_CO, "Explosive", 125)
elem.property(elements.KEV_PT_N2H4, "Explosive", 1550)
elem.property(elements.KEV_PT_R32, "Explosive", 0)
elem.property(elements.KEV_PT_S2O, "Explosive", 200)
elem.property(elements.KEV_PT_CL, "Explosive", 0)
elem.property(iodinevapor, "Explosive", 120)
elem.property(elements.KEV_PT_N2, "Properties", elem.TYPE_GAS+elem.PROP_DEADLY)
elem.property(elements.KEV_PT_N2O, "Properties", elem.TYPE_GAS+elem.PROP_DEADLY)
elem.property(elements.KEV_PT_O3, "Properties", elem.TYPE_GAS+elem.PROP_DEADLY)
elem.property(elements.KEV_PT_NH3, "Properties", elem.TYPE_GAS+elem.PROP_DEADLY)
elem.property(elements.KEV_PT_CH3NO, "Properties", elem.TYPE_GAS+elem.PROP_DEADLY)
elem.property(elements.KEV_PT_CH4, "Properties", elem.TYPE_GAS+elem.PROP_DEADLY)
elem.property(elements.KEV_PT_CO, "Properties", elem.TYPE_GAS+elem.PROP_DEADLY)
elem.property(elements.KEV_PT_N2H4, "Properties", elem.TYPE_GAS+elem.PROP_DEADLY)
elem.property(elements.KEV_PT_R32, "Properties", elem.TYPE_GAS+elem.PROP_NOAMBHEAT+elem.PROP_DEADLY+elem.PROP_NEUTPASS)
elem.property(elements.KEV_PT_S2O, "Properties", elem.TYPE_GAS+elem.PROP_DEADLY)
elem.property(elements.KEV_PT_CL, "Properties", elem.TYPE_GAS+elem.PROP_DEADLY)
elem.property(iodinevapor, "Properties", elem.TYPE_GAS+elem.PROP_DEADLY)
elem.property(elements.KEV_PT_N2O, "HighTemperatureTransition", elem.DEFAULT_PT_FIRE)
elem.property(elements.KEV_PT_O3, "HighTemperatureTransition", elem.DEFAULT_PT_OXYG)
elem.property(elements.KEV_PT_NH3, "HighTemperatureTransition", elem.DEFAULT_PT_FIRE)
elem.property(elements.KEV_PT_CH3NO, "HighTemperatureTransition", elem.DEFAULT_PT_PLSM)
elem.property(elements.KEV_PT_CH4, "HighTemperatureTransition", elem.DEFAULT_PT_FIRE)
elem.property(elements.KEV_PT_CO, "HighTemperatureTransition", elem.DEFAULT_PT_FIRE)
elem.property(elements.KEV_PT_N2H4, "HighTemperatureTransition", elem.DEFAULT_PT_PLSM)
elem.property(elements.KEV_PT_R32, "HighTemperatureTransition", elem.DEFAULT_PT_FIRE)
elem.property(elements.KEV_PT_S2O, "HighTemperatureTransition", elem.DEFAULT_PT_FIRE)
elem.property(iodinevapor, "HighTemperatureTransition", elem.DEFAULT_PT_FIRE)
elem.property(elements.KEV_PT_N2O, "HighTemperature", 800.15)
elem.property(elements.KEV_PT_O3, "HighTemperature", 493.15)
elem.property(elements.KEV_PT_NH3, "HighTemperature", 934.15)
elem.property(elements.KEV_PT_CH3NO, "HighTemperature", 790.15)
elem.property(elements.KEV_PT_CH4, "HighTemperature", 810.15)
elem.property(elements.KEV_PT_CO, "HighTemperature", 1837.15)
elem.property(elements.KEV_PT_N2H4, "HighTemperature", 856.15)
elem.property(elements.KEV_PT_R32, "HighTemperature", 2630.15)
elem.property(elements.KEV_PT_S2O, "HighTemperature", 765.15)
elem.property(iodinevapor, "HighTemperature", 750.15)
elem.property(elements.KEV_PT_R32, "Temperature", 0.15)
elem.property(elements.KEV_PT_N2, "LowTemperature", 180.15)
elem.property(elements.KEV_PT_N2, "LowTemperatureTransition", elem.DEFAULT_PT_LN2)
elem.property(elements.KEV_PT_N2O, "LowTemperature", 180.15)
elem.property(elements.KEV_PT_N2O, "LowTemperatureTransition", elem.DEFAULT_PT_LN2)
elem.property(elements.KEV_PT_N2, "HighPressureTransition", elem.DEFAULT_PT_LN2)
elem.property(elements.KEV_PT_N2O, "HighPressureTransition", elem.DEFAULT_PT_LN2)
elem.property(elements.KEV_PT_O3, "HighPressureTransition", elem.DEFAULT_PT_OXYG)
elem.property(elements.KEV_PT_NH3, "HighPressureTransition", elem.DEFAULT_PT_FIRE)
elem.property(elements.KEV_PT_CH3NO, "HighPressureTransition", elem.DEFAULT_PT_PLSM)
elem.property(elements.KEV_PT_CH4, "HighPressureTransition", elem.DEFAULT_PT_FIRE)
elem.property(elements.KEV_PT_CO, "HighPressureTransition", elem.DEFAULT_PT_FIRE)
elem.property(elements.KEV_PT_N2H4, "HighPressureTransition", elem.DEFAULT_PT_PLSM)
elem.property(elements.KEV_PT_R32, "HighPressureTransition", elem.DEFAULT_PT_FIRE)
elem.property(elements.KEV_PT_S2O, "HighPressureTransition", elem.DEFAULT_PT_FIRE)
elem.property(iodinevapor, "HighPressureTransition", iodine)
elem.property(elements.KEV_PT_N2, "HighPressure", 90)
elem.property(elements.KEV_PT_N2O, "HighPressure", 140)
elem.property(elements.KEV_PT_O3, "HighPressure", 30)
elem.property(elements.KEV_PT_NH3, "HighPressure", 225)
elem.property(elements.KEV_PT_CH3NO, "HighPressure", 125)
elem.property(elements.KEV_PT_CH4, "HighPressure", 78)
elem.property(elements.KEV_PT_CO, "HighPressure", 110)
elem.property(elements.KEV_PT_N2H4, "HighPressure", 90)
elem.property(elements.KEV_PT_R32, "HighPressure", 160)
elem.property(elements.KEV_PT_S2O, "HighPressure", 190)
elem.property(iodinevapor, "HighPressure", 10)
elem.property(elements.KEV_PT_N2, "Weight", 7)
elem.property(elements.KEV_PT_N2O, "Weight", 22)
elem.property(elements.KEV_PT_O3, "Weight", 24)
elem.property(elements.KEV_PT_NH3, "Weight", 10)
elem.property(elements.KEV_PT_CH3NO, "Weight", 20)
elem.property(elements.KEV_PT_CH4, "Weight", 10)
elem.property(elements.KEV_PT_CO, "Weight", 14)
elem.property(elements.KEV_PT_N2H4, "Weight", 18)
elem.property(elements.KEV_PT_R32, "Weight", 48)
elem.property(elements.KEV_PT_S2O, "Weight", 40)
elem.property(elements.KEV_PT_CL, "Weight", 17)
elem.property(iodinevapor, "Weight", 53)
elem.property(elements.KEV_PT_N2, "Diffusion", 1.9)
elem.property(elements.KEV_PT_N2O, "Diffusion", 1.1)
elem.property(elements.KEV_PT_O3, "Diffusion", 0.9)
elem.property(elements.KEV_PT_NH3, "Diffusion", 0.8)
elem.property(elements.KEV_PT_CH3NO, "Diffusion", 0.8)
elem.property(elements.KEV_PT_CH4, "Diffusion", 0.6)
elem.property(elements.KEV_PT_CO, "Diffusion", 0.2)
elem.property(elements.KEV_PT_N2H4, "Diffusion", 0.9)
elem.property(elements.KEV_PT_R32, "Diffusion", 1.2)
elem.property(elements.KEV_PT_S2O, "Diffusion", 0.9)
elem.property(elements.KEV_PT_CL, "Diffusion", 0.7)
elem.property(iodinevapor, "Diffusion", 0.7)
elem.property(elements.KEV_PT_N2, "Advection", 0)
elem.property(elements.KEV_PT_N2O, "Advection", 0.9)
elem.property(elements.KEV_PT_NH3, "Advection", 0.2)
elem.property(elements.KEV_PT_CH4, "Advection",0.1)
elem.property(elements.KEV_PT_CO, "Advection", 0.9)
elem.property(elements.KEV_PT_R32, "Advection", 1.1)
elem.property(elements.KEV_PT_S2O, "Advection", 1)
elem.property(elements.KEV_PT_CL, "Advection", 0.7)
elem.property(iodinevapor, "Advection", 1)
elem.property(elements.KEV_PT_N2, "Gravity", -0.3)
elem.property(elements.KEV_PT_N2O, "Gravity", -0.2)
elem.property(elements.KEV_PT_NH3, "Gravity", 0.02)
elem.property(elements.KEV_PT_CH4, "Gravity", 0.1)
elem.property(elements.KEV_PT_CO, "Gravity", -0.1)
elem.property(elements.KEV_PT_R32, "Gravity", -0.2)
elem.property(elements.KEV_PT_S2O, "Gravity", -0.1)
elem.property(elements.KEV_PT_CL, "Gravity", -0.1)
elem.property(iodinevapor, "Gravity", -0.07)
elem.property(elements.KEV_PT_R32, "HeatConduct", 16)
elem.property(elements.KEV_PT_N2H4, "Hardness", 255)

--LIQUIDS--------------------------------------------

local hydrogenperoxide = elem.allocate("KEV", "H2O2")
local sulfuricacid = elem.allocate("KEV", "H2SO4")
local nitricacid = elem.allocate("KEV", "HNO3")
local hydrocloric = elem.allocate("KEV", "HCL")
local sodiumhidroxide = elem.allocate("KEV", "NAOH")
local iodine = elem.allocate("KEV", "I")
local toluene = elem.allocate("KEV", "C7H8")
local mud = elem.allocate("KEV", "MUD")
elem.element(elements.KEV_PT_H2O2, elem.element(elem.DEFAULT_PT_WATR))
elem.element(elements.KEV_PT_H2SO4, elem.element(elem.DEFAULT_PT_SOAP))
elem.element(elements.KEV_PT_HCL, elem.element(elem.DEFAULT_PT_SOAP))
elem.element(elements.KEV_PT_HNO3, elem.element(elem.DEFAULT_PT_SOAP))
elem.element(elements.KEV_PT_C7H8, elem.element(elem.DEFAULT_PT_OIL))
elem.element(elements.KEV_PT_NAOH, elem.element(elem.DEFAULT_PT_WATR))
elem.element(iodine, elem.element(elem.DEFAULT_PT_SOAP))
elem.element(elements.KEV_PT_MUD, elem.element(elem.DEFAULT_PT_GEL))
elem.property(elements.KEV_PT_H2O2, "Name", "H2O2")
elem.property(elements.KEV_PT_H2SO4, "Name", "H2SO4")
elem.property(elements.KEV_PT_HCL, "Name", "HCL")
elem.property(elements.KEV_PT_HNO3, "Name", "HNO3")
elem.property(elements.KEV_PT_C7H8, "Name", "C7H8")
elem.property(elements.KEV_PT_NAOH, "Name", "NAOH")
elem.property(iodine, "Name", "I")
elem.property(elements.KEV_PT_MUD, "Name", "MUD")
elem.property(elements.KEV_PT_H2O2, "Description", "Hydrogen Peroxide. Descomposes when touches some metals.")
elem.property(elements.KEV_PT_H2SO4, "Description", "Sulfuric Acid. Strong acid, very reactive and useful.")
elem.property(elements.KEV_PT_HCL, "Description", "Chlorhydric Acid. Strong Acid, disolves almost all metals.")
elem.property(elements.KEV_PT_HNO3, "Description", "Nitric Acid. Soft but useful as an explosives precursor.")
elem.property(elements.KEV_PT_C7H8, "Description", "Toluene. Some explosives precursor.")
elem.property(elements.KEV_PT_NAOH, "Description", "Sodium Hydroxide. Alkali, reacts with acids.")
elem.property(iodine, "Description", "Iodine. Volatile, purifies WATR in only one touch.")
elem.property(elements.KEV_PT_MUD, "Description", "Mud. Get Dirty.")
elem.property(elements.KEV_PT_H2O2, "Color", 0x33A1C9)
elem.property(elements.KEV_PT_H2SO4, "Color", 0xFFE4E1)
elem.property(elements.KEV_PT_HCL, "Color", 0x7FFFD4)
elem.property(elements.KEV_PT_HNO3, "Color", 0xFAFF57)
elem.property(elements.KEV_PT_C7H8, "Color", 0x8F8F8F)
elem.property(elements.KEV_PT_NAOH, "Color", 0xF5FFFA)
elem.property(iodine, "Color", 0x610238)
elem.property(elements.KEV_PT_MUD, "Color", 0x5E2612)
elem.property(elements.KEV_PT_H2O2, "Flammable", 140)
elem.property(elements.KEV_PT_H2SO4, "Flammable", 0)
elem.property(elements.KEV_PT_HCL, "Flammable", 0)
elem.property(elements.KEV_PT_HNO3, "Flammable", 0)
elem.property(elements.KEV_PT_C7H8, "Flammable", 750)
elem.property(elements.KEV_PT_NAOH, "Flammable", 0)
elem.property(iodine, "Flammable", 0)
elem.property(elements.KEV_PT_MUD, "Flammable", 0)
elem.property(elements.KEV_PT_H2O2, "Explosive", 125)
elem.property(elements.KEV_PT_H2SO4, "Explosive", 625)
elem.property(elements.KEV_PT_HCL, "Explosive", 0)
elem.property(elements.KEV_PT_HNO3, "Explosive", 790)
elem.property(elements.KEV_PT_C7H8, "Explosive", 1150)
elem.property(elements.KEV_PT_NAOH, "Explosive", 750)
elem.property(iodine, "Explosive", 60)
elem.property(elements.KEV_PT_MUD, "Explosive", 0)
elem.property(elements.KEV_PT_H2O2, "Properties", elem.TYPE_LIQUID)
elem.property(elements.KEV_PT_H2SO4, "Properties", elem.TYPE_LIQUID+elem.PROP_DEADLY)
elem.property(elements.KEV_PT_HCL, "Properties", elem.TYPE_LIQUID+elem.PROP_DEADLY)
elem.property(elements.KEV_PT_HNO3, "Properties", elem.TYPE_LIQUID+elem.PROP_DEADLY)
elem.property(elements.KEV_PT_C7H8, "Properties", elem.TYPE_LIQUID)
elem.property(elements.KEV_PT_NAOH, "Properties", elem.TYPE_LIQUID+elem.PROP_DEADLY)
elem.property(iodine, "Properties", elem.TYPE_LIQUID)
elem.property(elements.KEV_PT_MUD, "Properties", elem.TYPE_LIQUID)
elem.property(elements.KEV_PT_H2O2, "HighTemperatureTransition", elem.DEFAULT_PT_WTRV)
elem.property(elements.KEV_PT_H2SO4, "HighTemperatureTransition", elem.KEV_PT_S2O)
elem.property(elements.KEV_PT_HNO3, "HighTemperatureTransition", elem.KEV_PT_N2O)
elem.property(elements.KEV_PT_C7H8, "HighTemperatureTransition", elem.DEFAULT_PT_FIRE)
elem.property(elements.KEV_PT_NAOH, "HighTemperatureTransition", elem.DEFAULT_PT_WTRV)
elem.property(iodine, "HighTemperatureTransition", iodinevapor)
elem.property(iodinevapor, "LowTemperature", 253.15)
elem.property(iodinevapor, "LowTemperatureTransition", iodine)
elem.property(elements.KEV_PT_MUD, "HighTemperatureTransition", elem.KEV_PT_DIRT)
elem.property(elements.KEV_PT_H2O2, "HighTemperature", 1832.15)
elem.property(elements.KEV_PT_H2SO4, "HighTemperature", 613.15)
elem.property(elements.KEV_PT_HNO3, "HighTemperature", 673.15)
elem.property(elements.KEV_PT_C7H8, "HighTemperature", 873.15)
elem.property(elements.KEV_PT_NAOH, "HighTemperature", 880.15)
elem.property(iodine, "HighTemperature", 574.15)
elem.property(elements.KEV_PT_MUD, "HighTemperature", 333.15)
elem.property(elements.KEV_PT_H2SO4, "Weight", 48)
elem.property(elements.KEV_PT_H2O2, "Weight", 18)
elem.property(elements.KEV_PT_HCL, "Weight", 18)
elem.property(elements.KEV_PT_HNO3, "Weight", 32)
elem.property(elements.KEV_PT_C7H8, "Weight", 50)
elem.property(elements.KEV_PT_NAOH, "Weight", 20)
elem.property(iodine, "Weight", 58)
elem.property(elements.KEV_PT_MUD, "Weight", 70)
elem.property(elements.KEV_PT_H2O2, "Advection", 0)
elem.property(elements.KEV_PT_H2SO4, "Advection", 0.4)
elem.property(elements.KEV_PT_HCL, "Advection", 0.5)
elem.property(elements.KEV_PT_HNO3, "Advection",0.3)
elem.property(elements.KEV_PT_C7H8, "Advection", 0.9)
elem.property(elements.KEV_PT_NAOH, "Advection", 0.9)
elem.property(iodine, "Advection", 1)
elem.property(elements.KEV_PT_MUD, "Advection", 0.1)


--EXPLOSIVES--------------------------------------------

local nitrogeniodide = elem.allocate("KEV", "NI3")
local blackgunpowder = elem.allocate("KEV", "BGUN")
local nitrogentrichloride = elem.allocate("KEV", "NCL3")
local amoniumnitrate = elem.allocate("KEV", "NH4O3")
local acetilene = elem.allocate("KEV", "C2H2")
local anfo = elem.allocate("KEV", "ANFO")
local sulfur = elem.allocate("KEV", "S")
local potassiumnitrate = elem.allocate("KEV", "KNO3")
local alumina = elem.allocate("KEV", "AL2O3")
elem.element(elements.KEV_PT_KNO3, elem.element(elem.DEFAULT_PT_THRM))
elem.element(elements.KEV_PT_AL2O3, elem.element(elem.DEFAULT_PT_THRM))
elem.element(elements.KEV_PT_NCL3, elem.element(elem.DEFAULT_PT_NITR))
elem.element(elements.KEV_PT_S, elem.element(elem.DEFAULT_PT_GUN))
elem.element(elements.KEV_PT_ANFO, elem.element(elem.DEFAULT_PT_DEST))
elem.element(elements.KEV_PT_NI3, elem.element(elem.DEFAULT_PT_DEST))
elem.element(elements.KEV_PT_BGUN, elem.element(elem.DEFAULT_PT_DEST))
elem.element(elements.KEV_PT_NH4O3, elem.element(elem.DEFAULT_PT_GUN))
elem.element(elements.KEV_PT_C2H2, elem.element(elem.DEFAULT_PT_FIRE))
elem.property(elements.KEV_PT_KNO3, "Name", "KNO3")
elem.property(elements.KEV_PT_AL2O3, "Name", "AL2O3")
elem.property(elements.KEV_PT_NCL3, "Name", "NCL3")
elem.property(elements.KEV_PT_S, "Name", "S")
elem.property(elements.KEV_PT_ANFO, "Name", "ANFO")
elem.property(elements.KEV_PT_NI3, "Name", "NI3")
elem.property(elements.KEV_PT_BGUN, "Name", "BGUN")
elem.property(elements.KEV_PT_NH4O3, "Name", "NH4O3")
elem.property(elements.KEV_PT_C2H2, "Name", "C2H2")
elem.property(elements.KEV_PT_KNO3, "Description", "Potassium Nitrate. Deflagrant Explosive.")
elem.property(elements.KEV_PT_AL2O3, "Description", "Alumina. Explodes only in presense of FIRE and under pressure.")
elem.property(elements.KEV_PT_NCL3, "Description", "Nitrogen Trichloride. Corrosive highly sensitive explosive.")
elem.property(elements.KEV_PT_S, "Description", "Sulfur. Made in the hell.")
elem.property(elements.KEV_PT_ANFO, "Description", "Amonium Nitrate-Fuel Oil. Explodes with a big power.")
elem.property(elements.KEV_PT_NI3, "Description", "Nitrogen Iodide. Highly sensitive explosive. Releases a purple gas cloud.")
elem.property(elements.KEV_PT_BGUN, "Description", "Black Gunpowder. Make it boom!.")
elem.property(elements.KEV_PT_NH4O3, "Description", "Amonium Nitrate. When is mixed with explosives or combustibles slowly release OXYG.")
elem.property(elements.KEV_PT_C2H2, "Description", "Acetilene. Burns hot! Explodes in contact with some metals.")
elem.property(elements.KEV_PT_KNO3, "Color", 0xD1EDE4)
elem.property(elements.KEV_PT_AL2O3, "Color", 0x44677C)
elem.property(elements.KEV_PT_NCL3, "Color", 0xEEC900)
elem.property(elements.KEV_PT_S, "Color", 0xE6FF1D)
elem.property(elements.KEV_PT_NI3, "Color", 0xAF123F)
elem.property(elements.KEV_PT_ANFO, "Color", 0xFFFFF0)
elem.property(elements.KEV_PT_BGUN, "Color", 0x2F4F4F)
elem.property(elements.KEV_PT_NH4O3, "Color", 0x8FBC8F)
elem.property(elements.KEV_PT_C2H2, "Color", 0xE0EEEE)
elem.property(elements.KEV_PT_KNO3, "Flammable", 0)
elem.property(elements.KEV_PT_AL2O3, "Flammable", 0)
elem.property(elements.KEV_PT_NCL3, "Flammable", 1230)
elem.property(elements.KEV_PT_S, "Flammable", 450)
elem.property(elements.KEV_PT_ANFO, "Flammable",9550)
elem.property(elements.KEV_PT_NI3, "Flammable", 0)
elem.property(elements.KEV_PT_BGUN, "Flammable", 1750)
elem.property(elements.KEV_PT_NH4O3, "Flammable", 0)
elem.property(elements.KEV_PT_C2H2, "Flammable", 250)
elem.property(elements.KEV_PT_KNO3, "Explosive", 0)
elem.property(elements.KEV_PT_AL2O3, "Explosive", 1)
elem.property(elements.KEV_PT_NCL3, "Explosive", 125)
elem.property(elements.KEV_PT_S, "Explosive", 0)
elem.property(elements.KEV_PT_ANFO, "Explosive", 7995)
elem.property(elements.KEV_PT_NI3, "Explosive", 0)
elem.property(elements.KEV_PT_BGUN, "Explosive", 175)
elem.property(elements.KEV_PT_NH4O3, "Explosive", 0)
elem.property(elements.KEV_PT_C2H2, "Explosive", 0)
elem.property(elements.KEV_PT_NI3, "HighTemperatureTransition", iodine)
elem.property(elements.KEV_PT_NI3, "HighTemperature", 323.15)
elem.property(elements.KEV_PT_AL2O3, "HighTemperatureTransition", elem.DEFAULT_PT_LAVA)
elem.property(elements.KEV_PT_AL2O3, "HighTemperature", 2345.15)
elem.property(elements.KEV_PT_S, "HighTemperatureTransition", elem.KEV_PT_S2O)
elem.property(elements.KEV_PT_S, "HighTemperature", 883.15)
elem.property(elements.KEV_PT_NI3, "LowPressureTransition", iodinevapor)
elem.property(elements.KEV_PT_NI3, "LowPressure", -75)
elem.property(elements.KEV_PT_KNO3, "Properties", elem.TYPE_PART)
elem.property(elements.KEV_PT_AL2O3, "Properties", elem.TYPE_PART)
elem.property(elements.KEV_PT_NCL3, "Properties", elem.TYPE_LIQUID)
elem.property(elements.KEV_PT_S, "Properties", elem.TYPE_PART)
elem.property(elements.KEV_PT_ANFO, "Properties", elem.TYPE_PART)
elem.property(elements.KEV_PT_NI3, "Properties", elem.TYPE_PART)
elem.property(elements.KEV_PT_BGUN, "Properties", elem.TYPE_PART)
elem.property(elements.KEV_PT_NH4O3, "Properties", elem.TYPE_PART)
elem.property(elements.KEV_PT_C2H2, "Properties", elem.TYPE_GAS)
elem.property(elements.KEV_PT_KNO3, "Weight", 50)
elem.property(elements.KEV_PT_AL2O3, "Weight", 68)
elem.property(elements.KEV_PT_NCL3, "Weight", 58)
elem.property(elements.KEV_PT_S, "Weight", 48)
elem.property(elements.KEV_PT_ANFO, "Weight", 120)
elem.property(elements.KEV_PT_NI3, "Weight", 60)
elem.property(elements.KEV_PT_BGUN, "Weight", 30)
elem.property(elements.KEV_PT_NH4O3, "Weight", 65)
elem.property(elements.KEV_PT_C2H2, "Weight", 14)
elem.property(elements.KEV_PT_KNO3, "Advection", 0.1)
elem.property(elements.KEV_PT_AL2O3, "Advection", 0.4)
elem.property(elements.KEV_PT_NCL3, "Advection", 0.1)
elem.property(elements.KEV_PT_S, "Advection",0.7)
elem.property(elements.KEV_PT_ANFO, "Advection", 0)
elem.property(elements.KEV_PT_NI3, "Advection", 0.1)
elem.property(elements.KEV_PT_BGUN, "Advection", 0.5)
elem.property(elements.KEV_PT_NH4O3, "Advection", 0.4)
elem.property(elements.KEV_PT_C2H2, "Diffusion", 0.9)
elem.property(elements.KEV_PT_C2H2, "Advection", 0.2)
elem.property(elements.KEV_PT_C2H2, "AirDrag", 0.5)
elem.property(elements.KEV_PT_C2H2, "AirLoss", 0.3)
elem.property(elements.KEV_PT_C2H2, "MenuSection", SC_EXPLOSIVE)
elem.property(elements.KEV_PT_I, "Hardness", 255)

--POWDERS--------------------------------------------------------------------------------------
local dirt = elem.allocate("KEV", "DIRT")
local seed = elem.allocate("KEV", "SEED")
local cement = elem.allocate("KEV", "CMNT")
local rock = elem.allocate("KEV", "ROCK")
local brokengraphite = elem.allocate("KEV", "BGPH")
local brokencarbono = elem.allocate("KEV", "BCAR")
local calciumcarbide= elem.allocate("KEV", "CAC2")
local siliconoxide = elem.allocate("KEV", "SIO2")
local cooperoxide = elem.allocate("KEV", "CUO")
local titanoxide = elem.allocate("KEV", "TIO2")
local coopersulfate = elem.allocate("KEV", "CUSO4")
elem.element(elements.KEV_PT_DIRT, elem.element(elem.DEFAULT_PT_STNE))
elem.element(elements.KEV_PT_SEED, elem.element(elem.DEFAULT_PT_DUST))
elem.element(elements.KEV_PT_CMNT, elem.element(elem.DEFAULT_PT_CNCT))
elem.element(elements.KEV_PT_BGPH, elem.element(elem.DEFAULT_PT_SAND))
elem.element(elements.KEV_PT_BCAR, elem.element(elem.DEFAULT_PT_DUST))
elem.element(elements.KEV_PT_CAC2, elem.element(elem.DEFAULT_PT_STNE))
elem.element(elements.KEV_PT_SIO2, elem.element(elem.DEFAULT_PT_SAND))
elem.element(elements.KEV_PT_CUO, elem.element(elem.DEFAULT_PT_CNCT))
elem.element(elements.KEV_PT_TIO2, elem.element(elem.DEFAULT_PT_BRMT))
elem.element(elements.KEV_PT_CUSO4, elem.element(elem.DEFAULT_PT_BRMT))
elem.element(elements.KEV_PT_ROCK, elem.element(elem.DEFAULT_PT_BRCK))
elem.property(elements.KEV_PT_DIRT, "Name", "DIRT")
elem.property(elements.KEV_PT_SEED, "Name", "SEED")
elem.property(elements.KEV_PT_CMNT, "Name", "CMNT")
elem.property(elements.KEV_PT_BGPH, "Name", "BGPH")
elem.property(elements.KEV_PT_BCAR, "Name", "BCAR")
elem.property(elements.KEV_PT_CAC2, "Name", "CAC2")
elem.property(elements.KEV_PT_SIO2, "Name", "SIO2")
elem.property(elements.KEV_PT_CUO, "Name", "CUO")
elem.property(elements.KEV_PT_TIO2, "Name", "TIO2")
elem.property(elements.KEV_PT_CUSO4, "Name", "CUSO4")
elem.property(elements.KEV_PT_ROCK, "Name", "ROCK")
elem.property(elements.KEV_PT_DIRT, "Description", "Dirt. Mother of life.")
elem.property(elements.KEV_PT_SEED, "Description", "Seed. Make it grow.")
elem.property(elements.KEV_PT_CMNT, "Description", "Portland Cement. Forge and get hard in contact with WATR.")
elem.property(elements.KEV_PT_BGPH, "Description", "Broken Graphite. Absorbs neutrons and photons. Used in nuclear reactors.")
elem.property(elements.KEV_PT_BCAR, "Description", "Broken Carbono. Useful as black.")
elem.property(elements.KEV_PT_CAC2, "Description", "Calcium Carbide. Used to produce C2H2, extracted from LIME.")
elem.property(elements.KEV_PT_SIO2, "Description", "Silice. A SAND, CMNT and GLASS component.")
elem.property(elements.KEV_PT_CUO, "Description", "Cooper Oxide. Semiconductor Type P.")
elem.property(elements.KEV_PT_TIO2, "Description", "Titanium Oxide. Heavy, used in batteries.")
elem.property(elements.KEV_PT_CUSO4, "Description", "Cooper Sulfate. Purifies WATR and intensifies explosives reactions.")
elem.property(elements.KEV_PT_ROCK, "Description", "Rock. Descomposes into various metal oxides and gases.")
elem.property(elements.KEV_PT_DIRT, "Color", 0x6D4D16)
elem.property(elements.KEV_PT_SEED, "Color", 0xCDAD00)
elem.property(elements.KEV_PT_CMNT, "Color", 0xD9D9D9)
elem.property(elements.KEV_PT_BGPH, "Color", 0x515151)
elem.property(elements.KEV_PT_BCAR, "Color", 0x1E1E1E)
elem.property(elements.KEV_PT_CAC2, "Color", 0x7A8B8B)
elem.property(elements.KEV_PT_SIO2, "Color", 0xEED5B7)
elem.property(elements.KEV_PT_CUO, "Color", 0x8CD3700)
elem.property(elements.KEV_PT_TIO2, "Color", 0xEEE9E9)
elem.property(elements.KEV_PT_CUSO4, "Color", 0x00C78C)
elem.property(elements.KEV_PT_ROCK, "Color", 0xCDB7B5)
elem.property(elements.KEV_PT_DIRT, "Flammable", 0)
elem.property(elements.KEV_PT_SEED, "Flammable", 50)
elem.property(elements.KEV_PT_CMNT, "Flammable", 0)
elem.property(elements.KEV_PT_BGPH, "Flammable", 0)
elem.property(elements.KEV_PT_BCAR, "Flammable", 115)
elem.property(elements.KEV_PT_CAC2, "Flammable", 0)
elem.property(elements.KEV_PT_SIO2, "Flammable", 3)
elem.property(elements.KEV_PT_CUO, "Flammable", 0)
elem.property(elements.KEV_PT_TIO2, "Flammable", 0)
elem.property(elements.KEV_PT_CUSO4, "Flammable", 0)
elem.property(elements.KEV_PT_DIRT, "Explosive", 0)
elem.property(elements.KEV_PT_SEED, "Explosive", 0)
elem.property(elements.KEV_PT_CMNT, "Explosive", 0)
elem.property(elements.KEV_PT_BGPH, "Explosive", 0)
elem.property(elements.KEV_PT_BCAR, "Explosive", 0)
elem.property(elements.KEV_PT_CAC2, "Explosive", 0)
elem.property(elements.KEV_PT_SIO2, "Explosive", 0)
elem.property(elements.KEV_PT_CUO, "Explosive", 0)
elem.property(elements.KEV_PT_TIO2, "Explosive", 0)
elem.property(elements.KEV_PT_CUSO4, "Explosive", 0)
elem.property(elements.KEV_PT_DIRT, "Properties", elem.TYPE_PART)
elem.property(elements.KEV_PT_SEED, "Properties", elem.TYPE_PART)
elem.property(elements.KEV_PT_CMNT, "Properties", elem.TYPE_PART)
elem.property(elements.KEV_PT_BGPH, "Properties", elem.TYPE_PART+elem.PROP_NEUTPENETRATE+elem.PROP_NEUTABSORB+elem.PROP_LIFE_DEC+elem.PROP_CONDUCTS)
elem.property(elements.KEV_PT_BCAR, "Properties", elem.TYPE_PART)
elem.property(elements.KEV_PT_CAC2, "Properties", elem.TYPE_PART)
elem.property(elements.KEV_PT_SIO2, "Properties", elem.TYPE_PART)
elem.property(elements.KEV_PT_CUO, "Properties", elem.TYPE_PART)
elem.property(elements.KEV_PT_TIO2, "Properties", elem.TYPE_PART+elem.PROP_NEUTPASS+elem.PROP_LIFE_DEC+elem.PROP_CONDUCTS+elem.PROP_HOT_GLOW)
elem.property(elements.KEV_PT_CUSO4, "Properties", elem.TYPE_PART+elem.PROP_DEADLY+elem.PROP_LIFE_DEC+elem.PROP_CONDUCTS+elem.PROP_HOT_GLOW)
elem.property(elements.KEV_PT_ROCK, "Properties", elem.TYPE_SOLID+elem.PROP_NEUTPASS+elem.PROP_HOT_GLOW)
elem.property(elements.KEV_PT_SEED, "HighTemperatureTransition", elem.DEFAULT_PT_FIRE)
elem.property(elements.DEFAULT_PT_STNE, "HighTemperatureTransition", elem.KEV_PT_ROCK)
elem.property(elements.KEV_PT_CMNT, "HighTemperatureTransition", elem.DEFAULT_PT_LAVA)
elem.property(elements.KEV_PT_BGPH, "HighTemperatureTransition", elem.DEFAULT_PT_LAVA)
elem.property(elements.KEV_PT_BCAR, "HighTemperatureTransition", elem.DEFAULT_PT_FIRE)
elem.property(elements.KEV_PT_CAC2, "HighTemperatureTransition", elem.DEFAULT_PT_LAVA)
elem.property(elements.KEV_PT_SIO2, "HighTemperatureTransition", elem.DEFAULT_PT_LAVA)
elem.property(elements.KEV_PT_CUO, "HighTemperatureTransition", elem.DEFAULT_PT_LAVA)
elem.property(elements.KEV_PT_TIO2, "HighTemperatureTransition", elem.DEFAULT_PT_LAVA)
elem.property(elements.KEV_PT_ROCK, "HighTemperatureTransition", elem.DEFAULT_PT_LAVA)
elem.property(elements.KEV_PT_SEED, "HighTemperature", 383.15)
elem.property(elements.DEFAULT_PT_STNE, "HighTemperature", 1233.15) --STNE molts into ROCK--
elem.property(elements.KEV_PT_CMNT, "HighTemperature", 593.15)
elem.property(elements.KEV_PT_BGPH, "HighTemperature", 934.15)
elem.property(elements.KEV_PT_BCAR, "HighTemperature", 990.15)
elem.property(elements.KEV_PT_CAC2, "HighTemperature", 2133.15)
elem.property(elements.KEV_PT_SIO2, "HighTemperature", 1986.15)
elem.property(elements.KEV_PT_CUO, "HighTemperature", 1599.15)
elem.property(elements.KEV_PT_TIO2, "HighTemperature", 2103.15)
elem.property(elements.KEV_PT_ROCK, "HighTemperature", 4293.15)
elem.property(elements.KEV_PT_DIRT, "HighPressureTransition", elem.DEFAULT_PT_STNE)
elem.property(elements.KEV_PT_SEED, "HighPressureTransition", elem.KEV_PT_DIRT)
elem.property(elements.KEV_PT_ROCK, "HighPressureTransition", elem.DEFAULT_PT_STNE)
elem.property(elements.KEV_PT_DIRT, "HighPressure", 90)
elem.property(elements.KEV_PT_SEED, "HighPressure", 140)
elem.property(elements.KEV_PT_ROCK, "HighPressure", 90)
elem.property(elements.KEV_PT_DIRT, "Weight", 80.98)
elem.property(elements.KEV_PT_SEED, "Weight", 12)
elem.property(elements.KEV_PT_CMNT, "Weight", 80)
elem.property(elements.KEV_PT_BGPH, "Weight", 45)
elem.property(elements.KEV_PT_BCAR, "Weight", 44)
elem.property(elements.KEV_PT_CAC2, "Weight", 64)
elem.property(elements.KEV_PT_SIO2, "Weight", 60)
elem.property(elements.KEV_PT_CUO, "Weight", 65)
elem.property(elements.KEV_PT_TIO2, "Weight", 79.87)
elem.property(elements.KEV_PT_CUSO4, "Weight", 79)
elem.property(elements.KEV_PT_DIRT, "Advection", 0.1)
elem.property(elements.KEV_PT_SEED, "Advection", 0.9)
elem.property(elements.KEV_PT_BGPH, "Advection", 0.2)
elem.property(elements.KEV_PT_CAC2, "Advection",0.1)
elem.property(elements.KEV_PT_SIO2, "Advection", 0.9)
elem.property(elements.KEV_PT_TIO2, "Advection", 1.1)
elem.property(elements.KEV_PT_CUSO4, "Advection", 0.7)

--SOLIDS--------------------------------------------------------------------------------------

local silver = elem.allocate("KEV", "AG")
local aluminium = elem.allocate("KEV", "AL")
local cooper= elem.allocate("KEV", "COOP")
local constructionsteel = elem.allocate("KEV", "STEL")
local graphite = elem.allocate("KEV", "GPHT")
local titaniumcarbide = elem.allocate("KEV", "TIC")
local turbine = elem.allocate("KEV", "TURB")
local fotovoltaicsilicon = elem.allocate("KEV", "SIV")
elem.element(elements.KEV_PT_AG, elem.element(elem.DEFAULT_PT_TTAN))
elem.element(elements.KEV_PT_AL, elem.element(elem.DEFAULT_PT_TTAN))
elem.element(elements.KEV_PT_COOP, elem.element(elem.DEFAULT_PT_PSCN))
elem.element(elements.KEV_PT_STEL, elem.element(elem.DEFAULT_PT_IRON))
elem.element(elements.KEV_PT_GPHT, elem.element(elem.DEFAULT_PT_IRON))
elem.element(elements.KEV_PT_TIC, elem.element(elem.DEFAULT_PT_TTAN))
elem.element(elements.KEV_PT_TURB, elem.element(elem.DEFAULT_PT_TTAN))
elem.element(elements.KEV_PT_SIV, elem.element(elem.DEFAULT_PT_PSCN))
elem.property(elements.KEV_PT_AG, "Name", "AG")
elem.property(elements.KEV_PT_AL, "Name", "AL")
elem.property(elements.KEV_PT_COOP, "Name", "COOP")
elem.property(elements.KEV_PT_STEL, "Name", "STEL")
elem.property(elements.KEV_PT_GPHT, "Name", "GPHT")
elem.property(elements.KEV_PT_TIC, "Name", "TIC")
elem.property(elements.KEV_PT_TURB, "Name", "TURB")
elem.property(elements.KEV_PT_SIV, "Name", "SIV")
elem.property(elements.KEV_PT_AG, "Description", "Silver. Conductive. Turns into IRON when touches PHOT.")
elem.property(elements.KEV_PT_AL, "Description", "Aluminium. Oxide Resistant. Conducts heat very well.")
elem.property(elements.KEV_PT_COOP, "Description", "Cooper. Conducts SPRK and heat very well.")
elem.property(elements.KEV_PT_STEL, "Description", "Construction Steel. Strong. Corrodes with the time.")
elem.property(elements.KEV_PT_GPHT, "Description", "Graphite. Absorbs neutrons and photons. Used in nuclear reactors.")
elem.property(elements.KEV_PT_TIC, "Description", "Titanium Carbide. Used to produce C2H2, extracted from LIME.")
elem.property(elements.KEV_PT_TURB, "Description", "Turbine. Products energy when touches a gas under pressure -BETA- (It doesnt works by now).")
elem.property(elements.KEV_PT_SIV, "Description", "Photovoltaic Silicon. Creates SPRK when touches a PHOT.")
elem.property(elements.KEV_PT_AG, "Color", 0xC0C0C0)
elem.property(elements.KEV_PT_AL, "Color", 0xFFFAF0)
elem.property(elements.KEV_PT_COOP, "Color", 0xCD950C)
elem.property(elements.KEV_PT_STEL, "Color", 0xD9E3E3)
elem.property(elements.KEV_PT_GPHT, "Color", 0x838B8B)
elem.property(elements.KEV_PT_TIC, "Color", 0x3C3C3C)
elem.property(elements.KEV_PT_TURB, "Color", 0x00FF00)
elem.property(elements.KEV_PT_SIV, "Color", 0x808A87)
elem.property(elements.KEV_PT_AG, "Flammable", 0)
elem.property(elements.KEV_PT_AL, "Flammable", 0)
elem.property(elements.KEV_PT_COOP, "Flammable", 0)
elem.property(elements.KEV_PT_STEL, "Flammable", 0)
elem.property(elements.KEV_PT_GPHT, "Flammable", 0)
elem.property(elements.KEV_PT_TIC, "Flammable", 0)
elem.property(elements.KEV_PT_TURB, "Flammable", 0)
elem.property(elements.KEV_PT_SIV, "Flammable", 0)
elem.property(elements.KEV_PT_AG, "Explosive", 0)
elem.property(elements.KEV_PT_AL, "Explosive", 0)
elem.property(elements.KEV_PT_COOP, "Explosive", 0)
elem.property(elements.KEV_PT_STEL, "Explosive", 0)
elem.property(elements.KEV_PT_GPHT, "Explosive", 0)
elem.property(elements.KEV_PT_TIC, "Explosive", 0)
elem.property(elements.KEV_PT_TURB, "Explosive", 0)
elem.property(elements.KEV_PT_SIV, "Explosive", 0)
elem.property(elements.KEV_PT_AL, "Properties", elem.TYPE_SOLID+elem.PROP_LIFE_DEC+elem.PROP_CONDUCTS+elem.PROP_HOT_GLOW)
elem.property(elements.KEV_PT_AG, "Properties", elem.TYPE_SOLID+elem.PROP_LIFE_DEC+elem.PROP_CONDUCTS+elem.PROP_HOT_GLOW)
elem.property(elements.KEV_PT_COOP, "Properties", elem.TYPE_SOLID+elem.PROP_NEUTPASS+elem.PROP_LIFE_DEC+elem.PROP_CONDUCTS+elem.PROP_HOT_GLOW)
elem.property(elements.KEV_PT_STEL, "Properties", elem.TYPE_SOLID+elem.PROP_LIFE_DEC+elem.PROP_CONDUCTS+elem.PROP_HOT_GLOW)
elem.property(elements.KEV_PT_GPHT, "Properties", elem.TYPE_SOLID+elem.PROP_NEUTABSORB+elem.PROP_HOT_GLOW)
elem.property(elements.KEV_PT_TIC, "Properties", elem.TYPE_SOLID+elem.PROP_NEUTPASS+elem.PROP_LIFE_DEC+elem.PROP_CONDUCTS+elem.PROP_HOT_GLOW)
elem.property(elements.KEV_PT_TURB, "Properties", elem.TYPE_SOLID+elem.PROP_NEUTPASS+elem.PROP_LIFE_DEC+elem.PROP_CONDUCTS+elem.PROP_HOT_GLOW)
elem.property(elements.KEV_PT_SIV, "Properties", elem.TYPE_SOLID+elem.PROP_NEUTPASS+elem.PROP_LIFE_DEC+elem.PROP_CONDUCTS+elem.PROP_HOT_GLOW)
elem.property(elements.KEV_PT_AL, "HighTemperatureTransition", elem.DEFAULT_PT_LAVA)
elem.property(elements.KEV_PT_AG, "HighTemperatureTransition", elem.DEFAULT_PT_LAVA)
elem.property(elements.KEV_PT_COOP, "HighTemperatureTransition", elem.DEFAULT_PT_LAVA)
elem.property(elements.KEV_PT_STEL, "HighTemperatureTransition", elem.DEFAULT_PT_LAVA)
elem.property(elements.KEV_PT_GPHT, "HighTemperatureTransition", elem.DEFAULT_PT_LAVA)
elem.property(elements.KEV_PT_TIC, "HighTemperatureTransition", elem.DEFAULT_PT_LAVA)
elem.property(elements.KEV_PT_TURB, "HighTemperatureTransition", elem.DEFAULT_PT_FIRE)
elem.property(elements.KEV_PT_SIV, "HighTemperatureTransition", elem.DEFAULT_PT_LAVA)
elem.property(elements.KEV_PT_AL, "HighTemperature", 1133.15)
elem.property(elements.KEV_PT_AG, "HighTemperature", 1234.93)
elem.property(elements.KEV_PT_COOP, "HighTemperature", 2460.73)
elem.property(elements.KEV_PT_STEL, "HighTemperature", 2373.15)
elem.property(elements.KEV_PT_GPHT, "HighTemperature", 2133.15)
elem.property(elements.KEV_PT_TIC, "HighTemperature", 8745.15)
elem.property(elements.KEV_PT_TURB, "HighTemperature", 1799.15)
elem.property(elements.KEV_PT_SIV, "HighTemperature", 2853.15)
elem.property(elements.KEV_PT_GPHT, "HighPressure", 90)
elem.property(elements.KEV_PT_GPHT, "HighPressureTransition", elements.KEV_PT_BGPH)
elem.property(elements.KEV_PT_AL, "Weight", 180.98)
elem.property(elements.KEV_PT_AG, "Weight", 194.00)
elem.property(elements.KEV_PT_COOP, "Weight", 190)
elem.property(elements.KEV_PT_STEL, "Weight", 185)
elem.property(elements.KEV_PT_GPHT, "Weight", 190)
elem.property(elements.KEV_PT_TIC, "Weight", 190)
elem.property(elements.KEV_PT_TURB, "Weight", 190)
elem.property(elements.KEV_PT_SIV, "Weight", 189)
elem.property(elements.KEV_PT_TURB, "MenuVisible", 0)




--------------------------------------------------------FUNCTIONS-PART-----------------------------------------------------------------

--NITROGEN--
    local function nUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then  --1) Nitrogen react with OXYG to form N2O--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_OXYG and sim.pressure(x/4, y/4) >= 25.30 then
                sim.partProperty(i, "type", elem.KEV_PT_N2O)
                sim.partProperty(r, "type", elem.KEV_PT_N2O)
                end   --2) Nitrogen react with WATR to form HNO3--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_WATR and sim.pressure(x/4, y/4) >= 5.30 then
                sim.partProperty(i, "type", elem.KEV_PT_HNO3)
                sim.partProperty(r, "type", elem.KEV_PT_N2O)
                end --3) Nitrogen react with DSTW to form HNO3--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_DSTW and sim.pressure(x/4, y/4) >= 5.30 then
                sim.partProperty(i, "type", elem.KEV_PT_HNO3)
                sim.partProperty(r, "type", elem.KEV_PT_N2O)
                end --4) Nitrogen react with PLNT to make grow VINE--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PLNT then
                sim.partProperty(i, "type", elem.DEFAULT_PT_VINE)
                sim.partProperty(r, "type", elem.KEV_PT_SEED)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wood")
                end  --5) Nitrogen react with HYGN to form NH3-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_HYGN and sim.pressure(x/4, y/4) >= 15.30 then
                sim.partProperty(i, "type", elem.KEV_PT_NH3)
                sim.partProperty(r, "type", elem.KEV_PT_NH3)
                end 
     end
    end

--NITROGEN OXIDE--
    local function n2oUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then  --1) Increse explosion force--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_FIRE then
	        tpt.set_pressure(x/4, y/4,1,6,115)
                tpt.set_property("type", "plsm", r)
                tpt.set_property("life", 85, r)
                tpt.set_property("type", "plsm", i)             
                end  --2) Nitrogen residue create after explotion--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PLSM then
                sim.partProperty(i, "type", nitg)
                sim.partProperty(r, "type", elem.DEFAULT_PT_PLSM)
                end  --3) Nitrogen Oxide react with HYGN to form HNO3-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_HYGN and sim.pressure(x/4, y/4) >= 2.30 then
                sim.partProperty(i, "type", elem.KEV_PT_HNO3)
                sim.partProperty(r, "type", elem.KEV_PT_HNO3)
                end  --4) Nitrogen Oxide react with WATR to form HNO3-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_WATR and math.random(1, 50) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_HNO3)
                sim.partProperty(r, "type", elem.KEV_PT_HNO3)
                end  --5) Nitrogen Oxide react with DSTW to form HNO3-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_DSTW and math.random(1, 70) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_HNO3)
                sim.partProperty(r, "type", elem.KEV_PT_HNO3)
                end
     end
    end

--OZONE--
    local function o3Update(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) Ozone rusts IRON into FE2O3-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_IRON then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OXYG)
                sim.partProperty(r, "type", elem.DEFAULT_PT_BRMT)
                end --2) Ozone rusts TTAN into TIO2-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_TTAN then
                sim.partProperty(i, "type", elem.KEV_PT_TIO2)
                sim.partProperty(r, "type", elem.DEFAULT_PT_OXYG)
                end --3) Ozone rusts STEEL into FE2O3-- 
             if sim.partProperty(r, "type") == elem.KEV_PT_STEL then
                sim.partProperty(i, "type", elem.DEFAULT_PT_BRMT)
                sim.partProperty(r, "type", elem.DEFAULT_PT_OXYG)
                end --4) Ozone rusts SI into SIO2-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_NTCT then
                sim.partProperty(i, "type", elem.KEV_PT_SIO2)
                sim.partProperty(r, "type", elem.DEFAULT_PT_OXYG)
                end --5) Ozone rusts TUNG into BREL-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_TUNG then
                sim.partProperty(i, "type", elem.KEV_PT_BREL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_OXYG)
                end --6) Ozone rusts BTRY into BREL-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_BTRY then
                sim.partProperty(i, "type", elem.DEFAULT_PT_BREL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_OXYG)
                end --7) Ozone purifies WATR of SALT-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_SLTW then
                sim.partProperty(i, "type", elem.DEFAULT_PT_WATR)
                sim.partProperty(r, "type", elem.DEFAULT_PT_OXYG)
                end  --8) Ozone turns into OXYG when a PHOT touches it-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PHOT then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OXYG)
                sim.partProperty(r, "type", elem.DEFAULT_PT_OXYG)
                end --9) Ozone Inestability-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_OXYG then
                sim.partProperty(i, "type", elem.DEFAULT_PT_LOXY)
                sim.partProperty(r, "type", elem.DEFAULT_PT_OXYG)
                end --10) Ozone Toxicity-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PLNT then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OXYG)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WOOD)
                end --11) Ozone as detonating of sensitive explosives-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PLEX then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OXYG)
                sim.partProperty(r, "type", elem.DEFAULT_PT_FIRE)
                end
             if sim.partProperty(r, "type") == elem.KEV_PT_CH3NO and sim.pressure(x/4, y/4) >= 3.30 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OXYG)
                sim.partProperty(r, "type", elem.DEFAULT_PT_FIRE)
                end
             if sim.partProperty(r, "type") == elem.KEV_PT_NI3 and sim.pressure(x/4, y/4) >= 2.30 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OXYG)
                sim.partProperty(r, "type", elem.DEFAULT_PT_PLSM)
                end
     end
    end

--AMONIAC--
    local function nh3Update(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) Amoniac reaction to form HNO3-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_OXYG and sim.pressure(x/4, y/4) >= 7.30 then
                sim.partProperty(i, "type", elem.KEV_PT_HNO3)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                end --2) FE2O3 catalyses reaction to form HNO3-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_BRMT then
                sim.partProperty(i, "type", elem.KEV_PT_HNO3)
                sim.partProperty(r, "type", elem.DEFAULT_PT_HNO3)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                end --3) Fertilizant function--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PLNT then
                sim.partProperty(i, "type", elem.KEV_PT_WOOD)
                sim.partProperty(r, "type", elem.DEFAULT_PT_VINE)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "seed")
                end
             if sim.partProperty(r, "type") == elem.KEV_PT_DIRT then
                sim.partProperty(i, "type", elem.KEV_PT_WOOD)
                sim.partProperty(r, "type", elem.DEFAULT_PT_VINE)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "seed")
                end  --4) NH3 reacts with H2O2 to form N2H4-- 
             if sim.partProperty(r, "type") == elem.KEV_PT_H2O2 and sim.pressure(x/4, y/4) >= 9.10 then
                sim.partProperty(i, "type", elem.KEV_PT_N2H4)
                sim.partProperty(r, "type", elem.DEFAULT_PT_N2H4)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
                end  --5) NH3 reacts with I to form NI3-- 
             if sim.partProperty(r, "type") == iodine then
                sim.partProperty(i, "type", elem.KEV_PT_NI3)
                sim.partProperty(r, "type", elem.KEV_PT_IODV)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2")
                end --6) NH3 reacts with CH4 to form CH3NO-- 
             if sim.partProperty(r, "type") == elem.KEV_PT_CH4 then
                sim.partProperty(i, "type", elem.KEV_PT_CH3NO)
                sim.partProperty(r, "type", elem.KEV_PT_CH3NO)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
                end 
     end
    end

--NITROMETHANE--
    local function ch3noUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) CH3NO reacts wth I or IODV to form NI3-- 
             if sim.partProperty(r, "type") == elem.KEV_PT_I then
                sim.partProperty(i, "type", elem.KEV_PT_NI3)
                sim.partProperty(r, "type", elem.KEV_PT_NI3)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "ch4")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                end  
             if sim.partProperty(r, "type") == elem.KEV_PT_IODV then
                sim.partProperty(i, "type", elem.KEV_PT_NI3)
                sim.partProperty(r, "type", elem.KEV_PT_NI3)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "ch4")
                end
     end
    end

--METHANE--
    local function ch4Update(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then  --1) CH4 reacts with OXYG to explode-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_OXYG then
                sim.partProperty(i, "type", elem.DEFAULT_PT_WTRV)
                sim.partProperty(r, "type", elem.DEFAULT_PT_PLSM)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co")
                end  --2) CH4 descomposes with WATR into CO2 and HYGN-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_WATR and sim.pressure(x/4, y/4) >= 9.10 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_CO2)
                sim.partProperty(r, "type", elem.DEFAULT_PT_HYGN)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co")
                end  --3) CH4 reacts with NITR to make CH3NO-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_NITR and sim.pressure(x/4, y/4) >= 9.10 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_CO2)
                sim.partProperty(r, "type", elem.DEFAULT_PT_HYGN)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co")
                end --5) CH4 reacts with HNO3 to form CH3NO-- 
             if sim.partProperty(r, "type") == elem.KEV_PT_HNO3 then
                sim.partProperty(i, "type", elem.KEV_PT_CH3NO)
                sim.partProperty(r, "type", elem.KEV_PT_CH3NO)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
                end --6) CH4 reacts with F-18 from RADMOD to form R.32-- 
             if sim.partProperty(r, "type") == elem.KEV_PT_F18 and sim.pressure(x/4, y/4) <= -2.10 then
                sim.partProperty(i, "type", elem.KEV_PT_R32)
                sim.partProperty(r, "type", elem.KEV_PT_R32)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                end 
     end
    end

--CARBON MONOXIDE--
    local function coUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) CO reacts with WATR to form BUBW-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_WATR then
                sim.partProperty(i, "type", elem.DEFAULT_PT_BUBW)
                sim.partProperty(r, "type", elem.DEFAULT_PT_CO2)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "ch4")
                end --2) CO reacts with OXYG to form CO2-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_OXYG then
                sim.partProperty(i, "type", elem.DEFAULT_PT_CO2)
                sim.partProperty(r, "type", elem.DEFAULT_PT_CO2)
                end --3) CO reacts with CH4 to form C3H8 and C3H8L-- 
             if sim.partProperty(r, "type") == elem.KEV_PT_CH4 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_GAS)
                sim.partProperty(r, "type", elem.DEFAULT_PT_OIL)
                end 
     end
    end

--HYDRAZINE--
    local function n2h4Update(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) N2H4 reacts with F to explode-- 
             if sim.partProperty(r, "type") == elem.KEV_PT_F then
                sim.partProperty(i, "type", elem.DEFAULT_PT_FIRE)
                sim.partProperty(r, "type", elem.DEFAULT_PT_FIRE)
                end
     end
    end

--FREON TYPE 32 or DIFLUORMETHANE--
    local function r32Update(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) R32 reacts with pressure to decrease its temperature-- 
             if sim.pressure(x/4, y/4) >= 25.10 then
                tpt.set_property("temp", -math.huge, x, y)
                end --2) R32 reacts with WATR to form ICE and LOXY-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_WATR then
                sim.partProperty(i, "type", elem.DEFAULT_PT_ICE)
                sim.partProperty(r, "type", elem.DEFAULT_PT_LOXY)
                end --3) R32 reacts with DSTW to form ICE and LOXY-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_DSTW then
                sim.partProperty(i, "type", elem.DEFAULT_PT_ICE)
                sim.partProperty(r, "type", elem.DEFAULT_PT_LOXY)
                end --4) R32 gets cold with pressure-- 
             if sim.pressure(x/4, y/4) >= 10.00 then
                tpt.set_property("temp", 9, x, y)
                end 
     end
    end

--SULFUR OXIDE--
    local function s2oUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) S2O reacts with DSTW to H2SO4-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_DSTW then
                sim.partProperty(i, "type", elem.KEV_PT_H2SO4)
                sim.partProperty(r, "type", elem.DEFAULT_PT_OXYG)
                end  --2) S2O reacts with WATR to H2SO4-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_WATR and math.random(1, 45) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_H2SO4)
                sim.partProperty(r, "type", elem.DEFAULT_PT_OXYG)
                sim.pressure(x/4,y/4,2)
                end  --3) S2O reacts with HYGN to H2SO4-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_HYGN and sim.pressure(x/4, y/4) >= 5.90 then
                sim.partProperty(i, "type", elem.KEV_PT_H2SO4)
                sim.partProperty(r, "type", elem.KEV_PT_H2SO4)
                end 
     end
    end

--CHLORINE--
    local function clUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) CL reacts with HYGN to HCL-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_HYGN then
                sim.partProperty(i, "type", elem.KEV_PT_HCL)
                sim.partProperty(r, "type", elem.KEV_PT_HCL)
                end --2) CL reacts with HYGN to HCL-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_HYGN then
                sim.partProperty(i, "type", elem.KEV_PT_HCL)
                sim.partProperty(r, "type", elem.KEV_PT_HCL)
                end --3) CL corrodes IRON-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_IRON and math.random(1,250) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_CL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
                end --4) CL corrodes TTAN-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_TTAN and math.random(1,250) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_CL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
                return 1
                end --5) CL corrodes SI-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PTCT and math.random(1,250) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_CL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_BREL)
                return 1
                end --6) CL corrodes SI5FE--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_METL and math.random(1,250) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_CL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                return 1
                end --7) CL corrodes COOP--
             if sim.partProperty(r, "type") == elem.KEV_PT_COOP and math.random(1,250) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_CL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
                return 1
                end --8) CL corrodes CNCW--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_BRCK and math.random(1,250) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_CL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                return 1
                end
     end
    end

--IODINE VAPOR--
    local function iodvUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) IODV purifies WATR-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_WATR then
                sim.partProperty(i, "type", elem.DEFAULT_PT_DSTW)
                sim.partProperty(r, "type", iodine)
                end
     end
    end

--GAS TO PROPANE---
elements.property(elements.DEFAULT_PT_GAS, "Name", "C3H8")
elements.property(elements.DEFAULT_PT_GAS, "Description", "Propane. Diffusses quickly and is flammable. Liquefies into OIL under pressure.")
elements.property(elements.DEFAULT_PT_GAS, "Color", 0xE0EEEE)
elements.property(elements.DEFAULT_PT_GAS, "Flammable", 3870)


------------------------------------------------------------------------------------------------LIQUIDS----------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

--HYDROGEN PEROXIDE--
    local function h2o2Update(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) H2O2 descomposes into OXYG and HYGN with FE2O3-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_BRMT then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OXYG)
                sim.partProperty(r, "type", elem.DEFAULT_PT_HYGN)
                sim.pressure(x/4,y/4,5)
                end  --2) H2O2 could ignite in contact with some metals-- 
             if sim.partProperty(r, "type") == elem.KEV_PT_COOP and math.random(1,440) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OXYG)
                sim.partProperty(r, "type", elem.DEFAULT_PT_HYGN)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                sim.pressure(x/4,y/4,12)
                end
             if sim.partProperty(r, "type") == elem.KEV_PT_AG and math.random(1,460) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OXYG)
                sim.partProperty(r, "type", elem.DEFAULT_PT_HYGN)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                sim.pressure(x/4,y/4,5)
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_IRON and math.random(1,110) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OXYG)
                sim.partProperty(r, "type", elem.DEFAULT_PT_HYGN)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                sim.pressure(x/4,y/4,5)
                end 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_METL and math.random(1,100) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OXYG)
                sim.partProperty(r, "type", elem.DEFAULT_PT_HYGN)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                sim.pressure(x/4,y/4,10)
                end 
  
     end
    end

--IODHYDRIC ACID--
elem.property(elements.DEFAULT_PT_ACID, "Description", "Iodhydric Acid. Ultracorrosive.")
elem.property(elements.DEFAULT_PT_ACID, "Name", "HI3")
elem.property(elements.DEFAULT_PT_ACID, "Color", 0xCD00CD)

    local function hi3Update(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) HI3 corrodes IRON-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_IRON and math.random(1,5) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_IODV)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_IRON and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end --2) HI3 corrodes TTAN-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_TTAN and math.random(1,10) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_IODV)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
                return 1
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_TTAN and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end --3) HI3 corrodes SI-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PTCT and math.random(1,20) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_IODV)
                sim.partProperty(r, "type", elem.DEFAULT_PT_BREL)
                return 1
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PTCT and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end --4) HI3 corrodes SI5FE--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_METL and math.random(1,10) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_IODV)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                return 1
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_METL and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end --5) HI3 corrodes COOP--
             if sim.partProperty(r, "type") == elem.KEV_PT_COOP and math.random(1,10) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_IODV)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
                return 1
                end
             if sim.partProperty(r, "type") == elem.KEV_PT_COOP and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end --6) HI3 corrodes CNCW--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_BRCK and math.random(1,50) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_CL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                return 1
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_BRCK and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end --7) HCL corrodes ALUM--
             if sim.partProperty(r, "type") == elem.KEV_PT_ALUM and math.random(1,30) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.KEV_PT_IODV)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                return 1
                end
             if sim.partProperty(r, "type") == elem.KEV_PT_ALUM and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end  --8) HI3 doesnt react with N2-- 
             if sim.partProperty(r, "type") == elem.KEV_PT_N2 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_ACID)
                sim.partProperty(r, "type", elem.KEV_PT_N2)
                end
     end
    end

--CHLORHYDRIC ACID--
    local function hclUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) HCL corrodes IRON-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_IRON and math.random(1,60) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_CL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_IRON and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end --2) HCL corrodes TTAN-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_TTAN and math.random(1,50) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_CL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
                return 1
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_TTAN and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end --3) HCL corrodes SI-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PTCT and math.random(1,50) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_CL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_BREL)
                return 1
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PTCT and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end --4) HCL corrodes SI5FE--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_METL and math.random(1,10) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_CL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                return 1
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_METL and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end --5) HCL corrodes COOP--
             if sim.partProperty(r, "type") == elem.KEV_PT_COOP and math.random(1,50) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_CL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
                return 1
                end
             if sim.partProperty(r, "type") == elem.KEV_PT_COOP and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end --6) HCL corrodes CNCW--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_BRCK and math.random(1,50) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_CL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                return 1
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_BRCK and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end --7) HCL corrodes ALUM--
             if sim.partProperty(r, "type") == elem.KEV_PT_ALUM and math.random(1,110) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.KEV_PT_CL)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                return 1
                end
             if sim.partProperty(r, "type") == elem.KEV_PT_ALUM and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end
     end
    end


--SULFURIC ACID--
    local function h2so4Update(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) H2SO4 corrodes IRON-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_IRON and math.random(1,45) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.KEV_PT_S2O)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fe2o3")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fe2o3")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fe2o3")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fe2o3")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fe2o3")
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_IRON and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end  --2) H2SO4 corrodes TTAN-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_TTAN and math.random(1,50) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_S2O)
                sim.partProperty(r, "type", elem.DEFAULT_PT_HYGN)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fe2o3")
                return 1
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_TTAN and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end --3) H2SO4 corrodes SI-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PTCT and math.random(1,50) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.DEFAULT_PT_BREL)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                return 1
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PTCT and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end --4) H2SO4 corrodes SI5FE--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_METL and math.random(1,20) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.KEV_PT_S2O)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fe2o3")
                return 1
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_METL and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end --5) H2SO4 corrodes COOP--
             if sim.partProperty(r, "type") == elem.KEV_PT_COOP and math.random(1,25) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.KEV_PT_S2O)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cuo")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cuo")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cuo")
                return 1
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_COOP and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end --6) H2SO4 corrodes CNCW--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_BRCK and math.random(1,950) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.KEV_PT_S2O)
                return 1
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_BRCK and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end --7) H2SO4 corrodes FILT--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_FILT and math.random(1,150) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.KEV_PT_S2O)
                return 1
                end --8) H2SO4 corrodes BRMT--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_BRMT and math.random(1,80) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.KEV_PT_S2O)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                return 1
                end 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_BRMT and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end--9) H2SO4 corrodes STNE--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_STNE and math.random(1,150) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.KEV_PT_S2O)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                return 1
                end 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_STNE and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end--10) H2SO4 corrodes LIME--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_CNCT and math.random(1,120) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.KEV_PT_S2O)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                return 1
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_CNCT and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end --11) H2SO4 corrodes PSCN--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PSCN and math.random(1,150) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.KEV_PT_S2O)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                return 1
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PSCN and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end  --12) H2SO4 Corrodes BE--
             if sim.partProperty(r, "type") == elem.KEV_PT_BE and math.random(1,45) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.KEV_PT_S2O)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "brel")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "brel")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "brel")
                return 1
                end
             if sim.partProperty(r, "type") == elem.KEV_PT_BE and math.random(1,15) == 1 then
                tpt.set_property("temp", 793, x, y)
                end
     end
    end

--NITRIC ACID--
    local function hno3Update(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) HNO3 corrodes IRON--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_IRON and math.random(1,180) == 1 then
                tpt.set_property("temp", 999, x, y)
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
                end 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_IRON and math.random(1,45) == 1 then
                tpt.set_property("temp", 863, x, y)
                end --2) HNO3 corrodes COOP--
             if sim.partProperty(r, "type") == elem.KEV_PT_COOP and math.random(1,215) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                end
             if sim.partProperty(r, "type") == elem.KEV_PT_COOP and math.random(1,45) == 1 then
                tpt.set_property("temp", 863, x, y)
                end  --3) HNO3 corrodes STEL--
             if sim.partProperty(r, "type") == elem.KEV_PT_STEL and math.random(1,243) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.set_property("temp", 999, x, y)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                end --4) HNO3 disolves WAX--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_WAX then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.set_property("temp", 999, x, y)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
                end --5) HNO3 disolves WAX--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_WAX then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.set_property("temp", 999, x, y)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
                end --6) HNO3 disolves GOO--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_GOO then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.set_property("temp", 999, x, y)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
                end --7) HNO3 disolves NSCN--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_NSCN then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.set_property("temp", 999, x, y)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
                end --8) HNO3 disolves PSCN--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PSCN then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.set_property("temp", 999, x, y)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
                end --9) HNO3 disolves WOOD--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_WOOD then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.set_property("temp", 999, x, y)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end --10) HNO3 disolves PLNT--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PLNT then
                sim.partProperty(i, "type", elem.DEFAULT_PT_WOOD)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.set_property("temp", 999, x, y)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "ch4")
                return 1
                end --11) HNO3 mix with SPNG to make IGNC--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_SPNG then
                sim.partProperty(r, "type", elem.DEFAULT_PT_IGNC)
                sim.partKill(i)
                end --12) HNO3 mix with MWAX to make NITR --
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_MWAX then
                sim.partProperty(i, "type", elem.DEFAULT_PT_NITR)
                sim.partProperty(r, "type", elem.DEFAULT_PT_NITR)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end --13) HNO3 mix with LIME to make KNO3 --
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_LIME then
                sim.partProperty(i, "type", elem.KEV_PT_KNO3)
                sim.partProperty(r, "type", elem.KEV_PT_STNE)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2")
                end --14) HNO3 mix with NAOH to make NANO3 --
             if sim.partProperty(r, "type") == elem.KEV_PT_NAOH then
                sim.partProperty(i, "type", elem.KEV_PT_NANO3)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WATR)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2")
                end  --15) HNO3 mix with NH4O3 to make NCL3 --
             if sim.partProperty(r, "type") == elem.KEV_PT_NH4O3 and sim.pressure(x/4, y/4) >= 20.90  then
                sim.partProperty(i, "type", elem.KEV_PT_NCL3)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.set_property("temp", 999, x, y)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl")
                end --16) HNO3 mix with NH3 to make NH4O3 --
             if sim.partProperty(r, "type") == elem.KEV_PT_NH3 then
                sim.partProperty(i, "type", elem.KEV_PT_NH4O3)
                sim.partProperty(r, "type", elem.KEV_PT_N2O)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl")
                end
     end
    end

--TOLUENE--
    local function c7h8Update(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) C7H8 reacts with CH3NO to form TNT--
             if sim.partProperty(r, "type") == elem.KEV_PT_CH3NO and math.random(1,80) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_TNT)
                sim.partProperty(r, "type", elem.DEFAULT_PT_TNT)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nitr")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nitr")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
                return 1
                end  --2) C7H8 reacts with NH3 to form TNT--
             if sim.partProperty(r, "type") == elem.KEV_PT_NH3 and math.random(1,8) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_TNT)
                sim.partProperty(r, "type", elem.DEFAULT_PT_TNT)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nitr")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
                return 1
                end  --3) C7H8 descomposes with PD to form C3H8--
             if sim.partProperty(r, "type") == elem.KEV_PT_PD and math.random(1,340) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_GAS)
                sim.partProperty(r, "type", elem.KEV_PT_PD)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "c3h8")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "c3h8")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "c3h8")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                return 1
                end   --4) C7H8 descomposes with IRON to form C3H8--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_IRON and math.random(1,29) >= 1.00 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_GAS)
                sim.partProperty(r, "type", elem.DEFAULT_PT_IRON)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "c3h8")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "c3h8")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "c3h8")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "c3h8")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "c3h8")
                return 1
                end
     end
    end

--SODIUM HYDROXIDE--
    local function naohUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then  --1) NAOH neutralizes HI to form NAI--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_ACID then
                sim.partProperty(i, "type", elem.KEV_PT_NAI)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WATR)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                return 1
                end  --2) NAOH neutralizes HCL to form NACL--
             if sim.partProperty(r, "type") == elem.KEV_PT_HCL then
                sim.partProperty(i, "type", elem.DEFAULT_PT_SALT)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WATR)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.set_pressure(x/4, y/4,2,2,1)
                return 1
                end  --3) NAOH neutralizes H2SO4 to form  replaced by LIME--
             if sim.partProperty(r, "type") == elem.KEV_PT_H2SO4 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_CNCT)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.set_pressure(x/4, y/4,2,2,1)
                return 1
                end
     end
    end


--IODINE--
    local function iodineUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) IOD purifies WATR--
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_WATR then
               sim.partProperty(i, "type", iodine)
               sim.partProperty(r, "type", elem.DEFAULT_PT_DSTW)
               end
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_DSTW and math.random(1,95) == 1 then
               sim.partProperty(r, "type", elem.DEFAULT_PT_DSTW)
               sim.partKill(i)
               end
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_SLTW then
               sim.partProperty(i, "type", iodine)
               sim.partProperty(r, "type", elem.DEFAULT_PT_DSTW)
               end
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_BUBW then
               sim.partProperty(i, "type", iodine)
               sim.partProperty(r, "type", elem.DEFAULT_PT_CO2)
               end  --2) HI formation
            if sim.partProperty(r, "type") == elem.KEV_PT_N2H4 then
               sim.partProperty(i, "type", elem.DEFAULT_PT_ACID)
               sim.partProperty(r, "type", elem.DEFAULT_PT_ACID)
               end
     end
    end

--MUD--
    local function mudUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then  --1) MUD converts into LIME and STONE in contact with FIRE--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_FIRE then
                sim.partProperty(i, "type", elem.DEFAULT_PT_CNCT)
                sim.partProperty(r, "type", elem.DEFAULT_PT_STNE)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "sand")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "sand")
                return 1
                end   --2) MUD converts into CLST and CNCT in contact with FIRE--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_FIRE and sim.pressure(x/4, y/4) >= 30.90 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_CNCT)
                sim.partProperty(r, "type", elem.DEFAULT_PT_STNE)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wtrv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "bgla")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "bgla")
                return 1
                end
     end
    end

--OIL TO PROPANE---
elements.property(elements.DEFAULT_PT_OIL, "Name", "C3H8L")
elements.property(elements.DEFAULT_PT_OIL, "Description", "Liquid Propane. Flammable. Gassifies into CH3H8 at low pressure.")
elements.property(elements.DEFAULT_PT_OIL, "Color", 0xCDC5BF)
elements.property(elements.DEFAULT_PT_OIL, "Flammable", 3870)

--WATR RENAME---
elements.property(elements.DEFAULT_PT_WATR, "Name", "H2O")

------------------------------------------------------------------------------------------------EXPLOSIVES----------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

--POTASSIUM NITRATE--
    local function kno3Update(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) Deflagrant explosion parameters--
             if sim.pressure(x/4, y/4) >= 6.90 then
	        tpt.set_pressure(x/4, y/4,2,2,65)
                tpt.set_property("type", "n2o", r)
                tpt.set_property("life", 85, r)
                tpt.set_property("type", "n2", i)            
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_FIRE then
	        tpt.set_pressure(x/4, y/4,2,2,65)
                tpt.set_property("type", "n2o", r)
                tpt.set_property("life", 85, r)
                tpt.set_property("type", "n2", i)            
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PLSM then
	        tpt.set_pressure(x/4, y/4,2,2,75)
                tpt.set_property("type", "plsm", r)
                tpt.set_property("life", 900, r)
                tpt.set_property("type", "plsm", i)             
                tpt.set_property("life", 1000, r)
                tpt.set_property("type", "n2o", i)              
                end
             if sim.partProperty(r, "type") == elem.KEV_PT_N2O then
                sim.partProperty(i, "type", elem.KEV_PT_N2O)
                sim.partProperty(r, "type", elem.DEFAULT_PT_N2O)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire") 
                end --2) KNO3 mix with S create GUN--
             if sim.partProperty(r, "type") == elem.KEV_PT_S then
                sim.partProperty(i, "type", elem.DEFAULT_PT_GUN)
                sim.partProperty(r, "type", elem.DEFAULT_PT_GUN) 
                end --3) KNO3 fertilizes DIRT--
             if sim.partProperty(r, "type") == elem.KEV_PT_DIRT then
                sim.partProperty(i, "type", elem.DEFAULT_PT_VINE)
                sim.partProperty(r, "type", elem.DEFAULT_PT_NEUT) 
                end --4) KNO3 reacts with HCL to form KCL and WATR--
             if sim.partProperty(r, "type") == elem.KEV_PT_HCL then
                sim.partProperty(i, "type", elem.KEV_PT_KCL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV) 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn") 
                tpt.set_pressure(x/4, y/4,5,10,1)
                end
     end
    end

--ALUMINIUM OXIDE--
    local function al2o3Update(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) Special explosion parameters--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_FIRE and sim.pressure(x/4, y/4) >= 1.90 then
                sim.partProperty(i, "type", elem.KEV_PT_AL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_FIRE) 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "embr")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "embr") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "thrm") 
                tpt.set_pressure(x/4, y/4,-1,1,35)    
                end               
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PLSM and sim.pressure(x/4, y/4) >= 2.90 then
                sim.partProperty(i, "type", elem.KEV_PT_AL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_EMBR) 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "embr") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "thrm") 
                tpt.set_pressure(x/4, y/4,-1,1,35)    
                end              
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_EMBR and sim.pressure(x/4, y/4) >= 5.90 then
                sim.partProperty(i, "type", elem.KEV_PT_AL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_FIRE) 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "thrm") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "thrm") 
                tpt.set_pressure(x/4, y/4,-1,1,35)    
                end--2) AL2O3 Absorbs OXYG--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_OXYG and sim.pressure(x/4, y/4) >= 10.90 then
                sim.partProperty(i, "type", elem.KEV_PT_AL2O3)
                sim.partProperty(r, "type", elem.KEV_PT_AL203)    
                end  --2) AL2O3 Absorbs OXYG--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_OXYG and sim.pressure(x/4, y/4) >= 10.90 then
                sim.partProperty(i, "type", elem.KEV_PT_AL2O3)
                sim.partProperty(r, "type", elem.KEV_PT_AL203)    
                end  --3) AL2O3 reverts corrotion of TTAN--
             if sim.partProperty(r, "type") == elem.KEV_PT_TIO2 then
                sim.partProperty(i, "type", elem.KEV_PT_AL2O3)
                sim.partProperty(r, "type", elem.DEFAULT_PT_TTAN) 
                tpt.set_pressure(x/4, y/4,1,2,-1.5)   
                end  --4) AL2O3 under pressure with SIO2 forms CLST--
             if sim.partProperty(r, "type") == elem.KEV_PT_SIO2	and sim.pressure(x/4, y/4) >= 12.00 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_CLST)
                sim.partProperty(r, "type", elem.DEFAULT_PT_CLST)   
                end  --5) AL2O3 mixed with FE3O2 forms THRM--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_BRMT then
                sim.partProperty(i, "type", elem.DEFAULT_PT_THRM)
                sim.partProperty(r, "type", elem.DEFAULT_PT_THRM)    
                end
     end
    end

--NITROGEN TRICHLORIDE--
    local function ncl3Update(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then  --1) NCL3 explosivity and flammability paramethers--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_FIRE then
                sim.partProperty(i, "type", elem.KEV_PT_NH3)
                sim.partProperty(r, "type", elem.KEV_PT_N2O) 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hcl") 
                tpt.set_pressure(x/4, y/4,-1,1,155)      
                end  
             if sim.pressure(x/4, y/4) >= 2.90 then
                sim.partProperty(i, "type", elem.KEV_PT_NH3)
                sim.partProperty(r, "type", elem.KEV_PT_N2O) 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn") 
                tpt.set_pressure(x/4, y/4,-1,1,155)
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PLSM then
                sim.partProperty(i, "type", elem.KEV_PT_NH3)
                sim.partProperty(r, "type", elem.KEV_PT_N2O) 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn") 
                tpt.set_pressure(x/4, y/4,-1,1,155)
                end  --2) NCL3 corrodes IRON--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_IRON and math.random(1,655) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.DEFAULT_PT_OXYG)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
                return 1
                end  --3) NCL3 corrodes METL--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_METL and math.random(1,695) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
                sim.partProperty(r, "type", elem.DEFAULT_PT_OXYG)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
                return 1
                end
     end
    end

--SULFUR--
    local function sUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) Special explosion parameters--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_FIRE then
                sim.partProperty(i, "type", elem.KEV_PT_S2O)
                sim.partProperty(r, "type", elem.DEFAULT_PT_FIRE) 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "s2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "s2o") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "s2o") 
                tpt.set_pressure(x/4, y/4,-1,1,35)    
                end 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PLSM then
                sim.partProperty(i, "type", elem.KEV_PT_S2O)
                sim.partProperty(r, "type", elem.DEFAULT_PT_FIRE) 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "s2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "s2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "s2o") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "s2o") 
                tpt.set_pressure(x/4, y/4,-1,1,35)    
                end  --2) S oxides with OXYG--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_OXYG and math.random(1,15) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_S2O)
                sim.partProperty(r, "type", elem.DEFAULT_PT_S2O)
                end  --3) S forms H2SO4 in contact with HCL--
             if sim.partProperty(r, "type") == elem.KEV_PT_HCL and math.random(1,15) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_HCL)
                sim.partProperty(r, "type", elem.KEV_PT_H2SO4)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cl") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "s2o") 
                end
     end
    end

--NITROCELLULOSE--
    ----No functions by now, wait for next version please--- 

--ANFO--
    local function anfoUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) Special explosive and flammability paramethers--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_FIRE then
                sim.partProperty(i, "type", elem.DEFAULT_PT_FIRE)
                sim.partProperty(r, "type", elem.DEFAULT_PT_PLSM)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                sim.pressure(x/4,y/4,195)
                tpt.set_property("temp", math.huge, x, y)
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PLSM then
                sim.partProperty(i, "type", elem.DEFAULT_PT_PLSM)
                sim.partProperty(r, "type", elem.DEFAULT_PT_PLSM)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.set_pressure(x/4, y/4,5,10,196)
                tpt.set_property("temp", math.huge, x, y)
                end
             if sim.pressure(x/4, y/4) >= 3.00 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_FIRE)
                sim.partProperty(r, "type", elem.DEFAULT_PT_FIRE)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.set_pressure(x/4, y/4,5,10,196)
                end
     end
    end
    

--NITROGEN IODIDE--
    local function ni3Update(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) Special explosive and flammability paramethers--
             if sim.partProperty(r, "type") == elem.KEV_PT_I then
                sim.partProperty(i, "type", elem.KEV_PT_IODV)
                sim.partProperty(r, "type", elem.KEV_PT_IODV)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv") 
                sim.pressure(x/4,y/4,85)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o") 
                tpt.set_property("temp", 403, x, y)
                end
             if sim.partProperty(r, "type") == elem.KEV_PT_IODV then
                sim.partProperty(i, "type", elem.KEV_PT_IODV)
                sim.partProperty(r, "type", elem.KEV_PT_IODV)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv") 
                sim.pressure(x/4,y/4,85)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_FIRE then
                sim.partProperty(i, "type", elem.KEV_PT_IODV)
                sim.partProperty(r, "type", elem.KEV_PT_IODV)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")  
                sim.pressure(x/4,y/4,85)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o") 
                tpt.set_property("temp", 403, x, y)
                end
             if sim.pressure(x/4, y/4) >= 2.00 then
                sim.partProperty(i, "type", elem.KEV_PT_IODV)
                sim.partProperty(r, "type", elem.KEV_PT_IODV)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv") 
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "iodv") 
                sim.pressure(x/4,y/4,85)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o") 
                tpt.set_property("temp", 403, x, y)
                end
     end
    end

--BLACK GUNPOWDER--
    local function bgunUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_FIRE then
                sim.partProperty(i, "type", elem.DEFAULT_PT_EMBR)
                sim.partProperty(r, "type", elem.DEFAULT_PT_EMBR)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")  
                sim.pressure(x/4,y/4,85)
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PLSM then
                sim.partProperty(i, "type", elem.DEFAULT_PT_EMBR)
                sim.partProperty(r, "type", elem.DEFAULT_PT_EMBR)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")  
                sim.pressure(x/4,y/4,85)
                end
     end
    end

--AMONIUM NITRATE--
    local function nh4o3Update(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) NH4O2 Comburent properties-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_HYGN and math.random(1,29) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OXYG)
                sim.partProperty(r, "type", elem.DEFAULT_PT_OXYG)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_FIRE and math.random(1,29) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OXYG)
                sim.partProperty(r, "type", elem.DEFAULT_PT_OXYG)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_OIL and math.random(1,25) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OXYG)
                sim.partProperty(r, "type", elem.KEV_PT_ANFO)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "anfo")
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_GAS and math.random(1,34) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OXYG)
                sim.partProperty(r, "type", elem.DEFAULT_PT_OXYG)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_NITR and math.random(1,30) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OXYG)
                sim.partProperty(r, "type", elem.DEFAULT_PT_NITR)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
                end
             if sim.partProperty(r, "type") == elem.KEV_PT_NCL3 and math.random(1,34) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OXYG)
                sim.partProperty(r, "type", elem.KEV_PT_NCL3)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
                end
             if sim.partProperty(r, "type") == elem.KEV_PT_C2H2 and math.random(1,26) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OXYG)
                sim.partProperty(r, "type", elem.DEFAULT_PT_OXYG)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
                end
             if sim.partProperty(r, "type") == elem.KEV_PT_CH4 and math.random(1,28) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OXYG)
                sim.partProperty(r, "type", elem.DEFAULT_PT_OXYG)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
                end --2) NH4O2 special flammability paramethers-- 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_FIRE and math.random(1,745) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OXYG)
                sim.partProperty(r, "type", elem.DEFAULT_PT_FIRE)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                end              
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_FIRE and sim.pressure(x/4, y/4) >= 2.00 and math.random(1,5) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OXYG)
                sim.partProperty(r, "type", elem.DEFAULT_PT_FIRE)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "embr")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "embr")
                sim.pressure(x/4,y/4,35)
                end
     end
    end

--ACETILENE--
    local function c2h2Update(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) Special explosive and flammability paramethers--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_FIRE then
                tpt.set_property("temp", math.huge, x, y)
                sim.partProperty(i, "type", elem.DEFAULT_PT_PLSM)
                sim.partProperty(r, "type", elem.DEFAULT_PT_PLSM)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "ch4")
                tpt.set_property("temp", math.huge, x, y)
                sim.pressure(x/4,y/4,15)
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PLSM then
                tpt.set_property("temp", math.huge, x, y)
                sim.partProperty(i, "type", elem.DEFAULT_PT_PLSM)
                sim.partProperty(r, "type", elem.DEFAULT_PT_PLSM)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
                tpt.set_property("temp", math.huge, x, y)
                tpt.set_pressure(x/4, y/4,5,10,19)
                end
             if sim.pressure(x/4, y/4) >= 153.00 then
                tpt.set_property("temp", math.huge, x, y)
                sim.partProperty(i, "type", elem.DEFAULT_PT_PLSM)
                sim.partProperty(r, "type", elem.DEFAULT_PT_PLSM)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "plsm")
                tpt.set_property("temp", math.huge, x, y)
                tpt.set_pressure(x/4, y/4,5,10,19)
                end
     end
    end

------------------------------------------------------------------------------------------------POWDERS----------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

--DIRT--
    local function dirtUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) LIME formation--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_SALT and math.random(1,7250) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_CNCT)
                sim.partProperty(r, "type", elem.DEFAULT_PT_CO2)
                end
             if sim.partProperty(r, "type") == elem.KEV_PT_CAC2 and math.random(1,9650) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_CNCT)
                sim.partProperty(r, "type", elem.DEFAULT_PT_CNCT)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end
             if math.random(1,33650) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_CNCT)
                sim.partProperty(r, "type", elem.DEFAULT_PT_CNCT)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end --2) FE2O3 formation--
             if math.random(1,952745) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_BRMT)
                sim.partProperty(r, "type", elem.DEFAULT_PT_BRMT)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end --3) STNE formation--
             if math.random(1,38745) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_STNE)
                sim.partProperty(r, "type", elem.DEFAULT_PT_STNE)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end  --4) KNO3 formation--            
             if sim.partProperty(r, "type") == elem.KEV_PT_N2 and math.random(1,7190) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_KNO3)
                sim.partProperty(r, "type", elem.KEV_PT_NH3)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end  --4) DIRT fertility--            
             if sim.partProperty(r, "type") == elem.KEV_PT_SEED and math.random(1,7) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_VINE)
                sim.partProperty(r, "type", elem.DEFAULT_PT_NEUT)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end
     end
    end

--ROCK FORMATION FROM STNE--
   local function stonetorockUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then   --1) N2 helps formation--
             if sim.partProperty(r, "type") == elem.KEV_PT_N2 and math.random(1,7750) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_ROCK)
                sim.partProperty(r, "type", elem.KEV_PT_ROCK)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end  --2) Pressure helps formation--
             if sim.pressure(x/4,y/4) >= 36.00 then
                sim.partProperty(i, "type", elem.KEV_PT_ROCK)
                sim.partProperty(r, "type", elem.KEV_PT_ROCK)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end  --3) SLTW helps formation--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_SLTW and math.random(1,2550) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_ROCK)
                sim.partProperty(r, "type", elem.KEV_PT_ROCK)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end  --4) WATR helps formation--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_WATR and math.random(1,3850) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_ROCK)
                sim.partProperty(r, "type", elem.KEV_PT_ROCK)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end  --5) SALT helps formation--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_SALT and math.random(1,100000) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_ROCK)
                sim.partProperty(r, "type", elem.KEV_PT_ROCK)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end  --6) AL2O3 helps formation--
             if sim.partProperty(r, "type") == elem.KEV_PT_AL2O3 and math.random(1,100000) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_ROCK)
                sim.partProperty(r, "type", elem.KEV_PT_ROCK)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end
     end
    end

--LIMESTONE--

elem.property(elements.DEFAULT_PT_CNCT, "Name", "LIME")
elem.property(elements.DEFAULT_PT_CNCT, "Description", "Limestone. Raw Material for CMNT. OIL and C3H8 can be extracted from it.")
elem.property(elements.DEFAULT_PT_CNCT, "HighTemperatureTransition", DEFAULT_PT_LAVA)
elem.property(elements.DEFAULT_PT_CNCT, "HighTemperature", 1783.15)
elem.property(elements.DEFAULT_PT_CNCT, "Color", 0xFFFFE0)
elem.property(elements.DEFAULT_PT_CNCT, "Weight", 96.00)

   local function limestoneUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then   --1) LIME converts into CAC2 when its burned with BCOL--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_LAVA and sim.partProperty(r, "ctype") == elem.KEV_PT_BGPH then
                sim.partProperty(i, "type", elem.KEV_PT_CAC2)
                sim.partProperty(r, "type", elem.KEV_PT_CAC2)
                end   
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_LAVA and sim.partProperty(i, "ctype") == elem.KEV_PT_BGPH then
                sim.partProperty(i, "type", elem.KEV_PT_CAC2)
                sim.partProperty(r, "type", elem.KEV_PT_CAC2)
                end  --2) BUBW helps formation--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_BUBW and math.random(1,19550) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_CNCT)
                sim.partProperty(r, "type", elem.DEFAULT_PT_QRTZ)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end  --4) CO2 helps formation--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_CO2 and math.random(1,13850) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_CNCT)
                sim.partProperty(r, "type", elem.DEFAULT_PT_CNCT)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end  --5) LIME Porosity--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_OIL and math.random(1,50) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OIL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_CNCT)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_GAS and math.random(1,50) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_GAS)
                sim.partProperty(r, "type", elem.DEFAULT_PT_CNCT)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_CH4 and math.random(1,50) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_CH4)
                sim.partProperty(r, "type", elem.DEFAULT_PT_CNCT)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_CO2 and math.random(1,50) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_OIL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_CNCT)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_WATR and math.random(1,50) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_CNCT)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WATR)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_WTRV and math.random(1,50) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_CMNT)
                sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end
             if sim.pressure(x/4, y/4) <= -12.00 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_GAS)
                sim.partProperty(r, "type", elem.DEFAULT_PT_STNE)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "qrtz")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "ch4")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "ch4")
                end --5) CMNT formation--
             if sim.partProperty(r, "type") == elem.KEV_PT_SIO2 and math.random(1,50) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_CMNT)
                sim.partProperty(r, "type", elem.KEV_PT_CMNT)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end
             if sim.partProperty(r, "type") == elem.KEV_PT_AL2O3 and math.random(1,100) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_CMNT)
                sim.partProperty(r, "type", elem.KEV_PT_CMNT)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_BRMT and math.random(1,10) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_CMNT)
                sim.partProperty(r, "type", elem.KEV_PT_CMNT)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end
     end
    end


--ROCK--
   local function rockUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) LIME formation--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_SALT and math.random(1,250) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_CNCT)
                sim.partProperty(r, "type", elem.DEFAULT_PT_CO2)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_SLTW and math.random(1,50) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_CNCT)
                sim.partProperty(r, "type", elem.DEFAULT_PT_CO2)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end
             if sim.partProperty(r, "type") == elem.KEV_PT_CAC2 and math.random(1,650) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_CNCT)
                sim.partProperty(r, "type", elem.DEFAULT_PT_CNCT)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end
             if math.random(1,13650) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_CNCT)
                sim.partProperty(r, "type", elem.DEFAULT_PT_CNCT)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end --2) FE2O3 formation--
             if math.random(1,32745) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_BRMT)
                sim.partProperty(r, "type", elem.DEFAULT_PT_BRMT)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end --3) STNE formation--
             if math.random(1,21745) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_STNE)
                sim.partProperty(r, "type", elem.DEFAULT_PT_STNE)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2")
                end --4) ROCK formation--
             if math.random(1,18945) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_ROCK)
                sim.partProperty(r, "type", elem.KEV_PT_ROCK)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end  --5) AL2O3 formation--
             if math.random(1,30590) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_AL2O3)
                sim.partProperty(r, "type", elem.KEV_PT_AL2O3)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                end  --6) CLST formation--
             if math.random(1,97590) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_CLST)
                sim.partProperty(r, "type", elem.DEFAULT_PT_CLST)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "c3h8")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "c3h8")
                end  --10) SIO2 formation--
             if math.random(1,70250) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_SIO2)
                sim.partProperty(r, "type", elem.KEV_PT_SIO2)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "c3h8")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "c3h8")
                end   --11) CUO formation--
             if math.random(1,80560) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_CUO)
                sim.partProperty(r, "type", elem.KEV_PT_CUO)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "c3h8")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "c3h8")
                end --12) BREL formation--
             if math.random(1,85650) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_BREL)
                sim.partProperty(r, "type", elem.DEFAULT_PT_BREL)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "c3h8")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "c3h8")
                end  --13) ROCK reformation--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_STNE and math.random(1,10260) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_ROCK)
                sim.partKill(r)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "stne")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "stne")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "c3h8")
                end 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_CNCT and math.random(1,58320) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_ROCK)
                sim.partProperty(r, "type", elem.KEV_PT_ROCK)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "stne")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "rock")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "c3h8")
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_BRMT and math.random(1,59400) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_ROCK)
                sim.partProperty(r, "type", elem.KEV_PT_ROCK)
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "stne")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "rock")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "c3h8")
                end  --14) ROCK GAS and WATR porosity--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_WATR and math.random(1,3600) == 1 then
                sim.partProperty(i, "type", elem.DEFAULT_PT_WATR)
                sim.partProperty(r, "type", elem.KEV_PT_ROCK)
                end 
             if sim.partProperty(r, "type") == elem.KEV_PT_CH4 and math.random(1,2350) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_CH4)
                sim.partProperty(r, "type", elem.KEV_PT_ROCK)
                end 
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_GAS and math.random(1,6880) == 1 then
                sim.partProperty(i, "type", elem.KEV_PT_CH4)
                sim.partProperty(r, "type", elem.KEV_PT_ROCK)
                end 
     end
    end

--SEED--
    --No functions by now, check again in the next actualization.--

--CEMENT--
   local function cementUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) CMNT consolides well into CNCW---
         if sim.partProperty(r, "type") == elem.DEFAULT_PT_WATR then
            sim.partProperty(i, "type", elem.DEFAULT_PT_BRCK)
            sim.partProperty(r, "type", elem.DEFAULT_PT_PSTE)
            tpt.set_property("temp", 363, x, y)
            end
         if sim.partProperty(r, "type") == elem.DEFAULT_PT_PSTE then
            sim.partProperty(i, "type", elem.DEFAULT_PT_BRCK)
            sim.partProperty(r, "type", elem.KEV_PT_CMNT)
            end  --2) CMNT consolides bad into CNCW and SALT---
         if sim.partProperty(r, "type") == elem.DEFAULT_PT_SLTW then
            sim.partProperty(i, "type", elem.DEFAULT_PT_SALT)
            sim.partProperty(r, "type", elem.DEFAULT_PT_PSTE)
            tpt.set_property("temp", 393, x, y)
            end
         if sim.partProperty(r, "type") == elem.DEFAULT_PT_SALT then
            sim.partProperty(i, "type", elem.DEFAULT_PT_STNE)
            sim.partProperty(r, "type", elem.DEFAULT_PT_SALT)
            end
         if sim.partProperty(r, "type") == elem.DEFAULT_PT_STNE and math.random(1,60) == 1 then
            sim.partProperty(i, "type", elem.DEFAULT_PT_CNCT)
            sim.partProperty(r, "type", elem.DEFAULT_PT_BRMT)
            end --2) CMNT consolides  bad into CNCW and CO2---
         if sim.partProperty(r, "type") == elem.DEFAULT_PT_BUBW then
            sim.partProperty(i, "type", elem.DEFAULT_PT_CO2)
            sim.partProperty(r, "type", elem.DEFAULT_PT_PSTE)
            tpt.set_property("temp", 323, x, y)
            end
     end
    end

--BROKENGRAPHITE--
    local function bgraphiteUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) BGPH oxides in contc with OXYG--
         if sim.partProperty(r, "type") == elem.DEFAULT_PT_OXYG and math.random(1,1620) == 1 then
            sim.partProperty(i, "type", elem.DEFAULT_PT_CO2)
            sim.partProperty(r, "type", elem.KEV_PT_BCAR)
            end      --2) BGPH produces HYGN when touches NEUT--
         if sim.partProperty(r, "type") == elem.DEFAULT_PT_NEUT and math.random(1,2) == 1 then
            sim.partProperty(i, "type", elem.KEV_PT_BGPH)
            sim.partProperty(r, "type", elem.DEFAULT_PT_HYGN)
            end     --2) BGPH absorbs PHOT--
         if sim.partProperty(r, "type") == elem.DEFAULT_PT_PHOT then
            sim.partKill(r)
            end
            
     end
    end

--BROKENCARBONO--
    local function bcarbonoUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then  --2) BCAR converts into C3H8 in presense of HYGN (rare) --
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_HYGN and math.random(1,16590) == 2 then
               sim.partProperty(r, "type", elem.DEFAULT_PT_GAS)
               sim.partKill(i)
               end --3) BCAR ignition--
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_FIRE then
               sim.partProperty(r, "type", elem.DEFAULT_PT_COAL)
               sim.partProperty(r, "type", elem.DEFAULT_PT_CO2)
               end --4) STEL aleation--
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_IRON and sim.partProperty(r, "ctype") == elem.DEFAULT_PT_LAVA then
               sim.partProperty(r, "type", elem.KEV_PT_STEL)
               sim.partKill(i)
               end
     end
    end

--CALCIUM CARBIDE--
    local function cac2Update(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then   --1) CAC2 converts into C2H2 with WATR--
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_WATR and math.random(1,3) == 2 then
               sim.partProperty(i, "type", elem.KEV_PT_C2H2)
               sim.partProperty(r, "type", elem.KEV_PT_C2H2)
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "s2o")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "s2o")
               end   --2) CAC2 converts into C2H2 with SLTW--
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_SLTW and math.random(1,9) == 2 then
               sim.partProperty(i, "type", elem.KEV_PT_C2H2)
               sim.partProperty(r, "type", elem.KEV_PT_C2H2)
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "s2o")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "salt")
               end  --3) CAC2 fertilizes DIRT with N2--
            if sim.partProperty(r, "type") == elem.KEV_PT_DIRT and math.random(1,93) == 2 then
               sim.partProperty(i, "type", elem.DEFAULT_PT_PLNT)
               sim.partProperty(r, "type", elem.KEV_PT_C2H2)
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "nh3")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "n2o")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "s2o")
               end 
     end
    end

--SILICON DIOXIDE--
    local function sio2Update(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) SIO2 in contact with FIRE forms BGLA--
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_FIRE and math.random(1,3) == 2 then
               sim.partProperty(i, "type", elem.DEFAULT_PT_BGLA)
               sim.partProperty(r, "type", elem.DEFAULT_PT_PQRT)
               end  --3) SIO2 in contact with DUST forms SAND--
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_DUST and math.random(1,3) == 2 then
               sim.partProperty(i, "type", elem.DEFAULT_PT_SAND)
               sim.partProperty(r, "type", elem.DEFAULT_PT_SAND)
               end --4) SIO2 in contact with SLTW forms QRTZ--
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_SLTW and math.random(1,300) == 2 then
               sim.partProperty(i, "type", elem.DEFAULT_PT_QRTZ)
               sim.partProperty(r, "type", elem.DEFAULT_PT_WATR)
               end --5) SIO2 in contact with FIRE forms BGLA--
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_FIRE and math.random(1,3) == 2 then
               sim.partProperty(i, "type", elem.DEFAULT_PT_BGLA)
               sim.partProperty(r, "type", elem.DEFAULT_PT_PQRT)
               end 
     end
    end

--COOPER OXIDE--
    local function cuoUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) CUO in contact with HYGN forms COOP and WATR--
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_HYGN and math.random(1,60) == 2 then
               sim.partProperty(i, "type", elem.KEV_PT_COOP)
               sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
               end  --2) CUO in contact with H2SO4 forms CUSO4 and WATR--
            if sim.partProperty(r, "type") == elem.KEV_PT_H2SO4 and math.random(1,160) == 2 then
               sim.partProperty(i, "type", elem.KEV_PT_CUSO4)
               sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
               end  --3) CUO in contact with NAOH forms ELEC --
            if sim.partProperty(r, "type") == elem.KEV_PT_NAOH and math.random(1,6530) == 1 then
               sim.partProperty(i, "type", elem.KEV_PT_NAOH)
               sim.partProperty(r, "type", elem.DEFAULT_PT_ELEC)
               end  --4) CUO in contact with CO forms COOP and WATR--
            if sim.partProperty(r, "type") == elem.KEV_PT_CO and math.random(1,120) == 2 then
               sim.partProperty(i, "type", elem.KEV_PT_COOP)
               sim.partProperty(r, "type", elem.DEFAULT_PT_CO2)
               end --5) CUO reacts with FIRE forms EMBR and COOP--
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_FIRE then
               sim.partProperty(i, "type", elem.KEV_PT_COOP)
               sim.partProperty(r, "type", elem.DEFAULT_PT_EMBR)
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "embr")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "embr")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "smke")
               end 
     end
    end

--TITANIUM OXIDE--
    local function tio2Update(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) TIO2 in contact with NAOH gets sparked--
            if sim.partProperty(r, "type") == elem.KEV_PT_NAOH and math.random(1,4) == 2 then
               sim.partProperty(i, "type", elem.DEFAULT_PT_SPRK)
               sim.partProperty(i, "ctype", elem.KEV_PT_TIO2)
               end
     end
    end 

--TITANIUM FORMS OXIDE--
    local function oxttanUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_OXYG and math.random(1,6790) == 2 then
                sim.partProperty(r, "type", titanoxid)
                sim.partKill(i)
                end   
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_SLTW and math.random(1,3415) == 2 then
                sim.partProperty(r, "type", titanoxid)
                sim.partKill(i)
                end
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_WATR and math.random(1,4880) == 2 then
                sim.partProperty(r, "type", titanoxid)
                sim.partKill(i)
                end
     end
    end

--COOPER SULFATE--
    local function cuso4Update(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) CUSO4 purifies WATR, SLTW and BUBW--
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_SLTW then
               sim.partProperty(r, "type", elem.DEFAULT_PT_DSTW)
               sim.partKill(i)
               end
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_BUBW then
               sim.partProperty(r, "type", elem.DEFAULT_PT_DSTW)
               sim.partKill(i)
               end
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_WATR then
               sim.partProperty(r, "type", elem.DEFAULT_PT_DSTW)
               sim.partKill(i)
               end  --2) CUSO4 slowly kills PLNT
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_PLNT and math.random(1,2) == 2 then
               sim.partProperty(i, "type", elem.KEV_PT_CO)
               sim.partProperty(r, "type", elem.DEFAULT_PT_CO2)
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wood")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wood")
               end  --3) CUSO4 slowly kills VINE
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_VINE and math.random(1,2) == 2 then
               sim.partProperty(i, "type", elem.KEV_PT_CUSO4)
               sim.partProperty(r, "type", elem.DEFAULT_PT_CO2)
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wood")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "wood")
               end  --4) CUSO4 slowly turns WOOD into DIRT
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_WOOD and math.random(1,5) == 2 then
               sim.partProperty(i, "type", elem.KEV_PT_CUSO4)
               sim.partProperty(r, "type", elem.DEFAULT_PT_CO2)
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "stne")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "dirt")
               end  --5) Special explosive and flammability paramethers--
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_FIRE and math.random(1,50) == 1 then
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "s2o")
                tpt.create(x+math.random(-1,1), y+math.random(-1,1), "cuo")
                sim.pressure(x/4,y/4,75)
                end
     end
    end 


--HEMATITE AN IRON OXIDE--
elements.property(elements.DEFAULT_PT_BRMT, "Name", "FE2O3")
elements.property(elements.DEFAULT_PT_BRMT, "Description", "Hematite, an IRON oxide, an adsorbent of WTRV. Absorbs microwaves like PHOT and ELEC.")
elements.property(elements.DEFAULT_PT_BRMT, "Color", 0x882D17)
elements.property(elements.DEFAULT_PT_BRMT, "Flammable", 0)

--SALT RENAME---
elements.property(elements.DEFAULT_PT_SALT, "Name", "NACL")



------------------------------------------------------------------------------------------------SOLIDS----------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

--ALUMINIUM--  
    local function alUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) AL reflects ELEC in form of EMBR--
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_ELEC and math.random(1,2) == 2 then
               sim.partProperty(i, "type", elem.DEFAULT_PT_EMBR)
               sim.partProperty(r, "type", elem.KEV_PT_AL)
               end  --2) AL reflects PHOT in form of EMBR--
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_PHOT and math.random(1,2) == 2 then
               sim.partProperty(i, "type", elem.DEFAULT_PT_EMBR)
               sim.partProperty(r, "type", elem.KEV_PT_AL)
               end --3) AL oxides with WTRV--
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_WTRV and math.random(1,5) == 2 then
               sim.partProperty(i, "type", elem.KEV_PT_AL2O3)
               sim.partProperty(r, "type", elem.DEFAULT_PT_WTRV)
               end --4) AL oxides with O3--
            if sim.partProperty(r, "type") == elem.KEV_PT_O3 and math.random(1,5) == 2 then
               sim.partProperty(i, "type", elem.KEV_PT_AL2O3)
               sim.partProperty(r, "type", elem.KEV_PT_AL2O3)
               end 
     end
    end 

--SILVER--  
    local function agUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) AG reflects ELEC in form of EMBR--
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_ELEC then
               sim.partProperty(i, "type", elem.DEFAULT_PT_EMBR)
               sim.partProperty(r, "type", elem.KEV_PT_AG)
	       tpt.set_property("life", 3000, i)
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "embr")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "embr")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "embr")
               end  --2) AG in presence of PHOT transform in IRON--
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_PHOT then
               sim.partProperty(i, "type", elem.DEFAULT_PT_IRON)
               sim.partProperty(r, "type", elem.DEFAULT_PT_PHOT)
               end --3) Molten AG forms SIv with molten SI--
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_LAVA and sim.partProperty(r, "ctype") == elem.DEFAULT_PT_NTCT then
               sim.partProperty(i, "type", elem.KEV_PT_SIV)
               sim.partProperty(r, "type", elem.KEV_PT_SIV)
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "co2")
               end --4) AG forms RAZR with pressure--
            if sim.pressure(x/4, y/4) == 75.00 then
               sim.partProperty(i, "type", elem.DEFAULT_PT_RAZR)
               sim.partProperty(r, "type", elem.DEFAULT_PT_RAZR)
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
               end --5) AG forms RAZR with OXYG--
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_OXYG and math.random(1,485) == 1 then
               sim.partProperty(i, "type", elem.DEFAULT_PT_RAZR)
               sim.partProperty(r, "type", elem.DEFAULT_PT_RAZR)
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
               tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
               end 
     end
    end 

--SILICON NITRIDE--  
--No functions by now, check again in the next update.--


--TURBINE--
--In BETA by now, it doesnt have any function. It doesnt do anything.--
    local function turbineUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then
            print("No functional by now, please wait :) ")
       
     end
    end

--GRAPHITE--
    local function graphiteUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) GPHT oxides in contc with OXYG--
         if sim.partProperty(r, "type") == elem.DEFAULT_PT_OXYG and math.random(1,1620) == 1 then
            sim.partProperty(i, "type", elem.DEFAULT_PT_CO2)
            sim.partProperty(r, "type", elem.KEV_PT_BCAR)
            end      --2) GPHT produces HYGN when touches NEUT--
         if sim.partProperty(r, "type") == elem.DEFAULT_PT_NEUT and math.random(1,2) == 1 then
            sim.partProperty(i, "type", elem.KEV_PT_GPHT)
            sim.partProperty(r, "type", elem.DEFAULT_PT_PHOT)
            end     --2) GPHT absorbs PHOT--
         if sim.partProperty(r, "type") == elem.DEFAULT_PT_PHOT then
            sim.partKill(r)
            end
            
     end
    end

--TITANIUM CARBIDE--
    local function ticUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) TIC converts OXYG into CO2--
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_OXYG and sim.pressure(x/4, y/4) >= 75.30 then
               sim.partProperty(i, "type", elem.DEFAULT_PT_TTAN)
               sim.partProperty(r, "type", elem.DEFAULT_PT_CO2)
               end  
     end
    end

--PHOTOVOLTAIC SILICON ---
    local function sivUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) Photovoltaic Properties of SIV             
             if sim.partProperty(r, "type") == elem.DEFAULT_PT_PHOT then
	        tpt.create(x+math.random(-1,1), y+math.random(-1,1), "elec")
	        sim.partProperty(i, "type", elem.KEV_PT_SIV)
                sim.partProperty(i, "ctype", elem.DEFAULT_PT_SPRK)
                sim.partProperty(i, "tmp", sim.partProperty(i, "tmp")+1)
                sim.pressure(x/4,y/4,4)
                end
             if sim.partProperty(r, "type") == elem.KEV_PT_O3 then
	        tpt.create(x+math.random(-1,1), y+math.random(-1,1), "brel")
                sim.partProperty(i, "type", elem.KEV_PT_SIO2)
                sim.partProperty(r, "type", elem.DEFAULT_PT_NTCT)
                end
             if sim.partProperty(r, "type") == elem.KEV_PT_F18 then
	        tpt.create(x+math.random(-1,1), y+math.random(-1,1), "fire")
	        tpt.create(x+math.random(-1,1), y+math.random(-1,1), "brel")
                sim.pressure(x/4,y/4,4)
                end
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_LAVA and sim.partProperty(r, "ctype") == elem.DEFAULT_PT_IRON then
               sim.partProperty(i, "type", elem.DEFAULT_PT_METL)
               sim.partProperty(r, "type", elem.DEFAULT_PT_METL)
               end
     end
    end            







--BMTL TO BRAS
elements.property(elements.DEFAULT_PT_BMTL, "Name", "BRAS")
elements.property(elements.DEFAULT_PT_BMTL, "Description", "Brass. Breakeable semiconductor.")
elements.property(elements.DEFAULT_PT_BMTL, "Color", 0xCDAD00)
elements.property(elements.DEFAULT_PT_BMTL, "Flammable", 0)
elements.property(elements.DEFAULT_PT_BMTL, "HighPressure", 9.90)
elements.property(elements.DEFAULT_PT_BMTL, "HighPressureTransition", elem.KEV_PT_CUO)
elements.property(elements.DEFAULT_PT_BMTL, "MenuSection", SC_ELECTRONICS)

    local function brassUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) BRASS breaks into CUO under pressure--
            if sim.pressure(x/4, y/4) >= 9.20 then
               sim.partProperty(i, "type", elem.KEV_PT_CUO)
               end 
            if sim.pressure(x/4, y/4) <= 9.20 then
               sim.partProperty(i, "type", elem.DEFAULT_PT_BMTL)
               end 
     end
    end 

--NTCT TO SILICON
elements.property(elements.DEFAULT_PT_NTCT, "Name", "SI")
elements.property(elements.DEFAULT_PT_NTCT, "Description", "Silicon. Semiconductor, only conducts when it's over 100 °C.")
elements.property(elements.DEFAULT_PT_NTCT, "Color", 0x2F4F4F)
elements.property(elements.DEFAULT_PT_NTCT, "Flammable", 0)

--PTCT TO GERMANIUM
elements.property(elements.DEFAULT_PT_PTCT, "Name", "GE")
elements.property(elements.DEFAULT_PT_PTCT, "Description", "Germanium. Semiconductor, only conducts when it's under 100 °C.")
elements.property(elements.DEFAULT_PT_PTCT, "Color", 0xEEE9BF)
elements.property(elements.DEFAULT_PT_PTCT, "Flammable", 0)

--METL TO ELECTRIC USE STEEL--
elements.property(elements.DEFAULT_PT_METL, "Name", "SI5FE")
elements.property(elements.DEFAULT_PT_METL, "Description", "Electric Steel. Conducts SPRK and heat very well.")
elements.property(elements.DEFAULT_PT_METL, "Color", 0x708090)
elements.property(elements.DEFAULT_PT_METL, "HighTemperature", 3100)
elements.property(elements.DEFAULT_PT_METL, "HighTemperatureTransition", elem.DEFAULT_PT_LAVA)
elements.property(elements.DEFAULT_PT_METL, "HeatConduct", 0.4)

--RUBIDIUM WELL NAMED--
elements.property(elements.DEFAULT_PT_RBDM, "Name", "RB")
elements.property(elements.DEFAULT_PT_RBDM, "Description", "Rubidium. Explosive when is exposed to humidity. Photosensible when it´s cold, absorbs OXYG.")
elements.property(elements.DEFAULT_PT_RBDM, "Flammable", 5)
elements.property(elements.DEFAULT_PT_RBDM, "Explosive", 2400)

    local function rbextrafeaturesUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_WTRV then
               sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
               sim.partProperty(r, "type", elem.DEFAULT_PT_FIRE)
               end
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_DSTW then
               sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
               sim.partProperty(r, "type", elem.DEFAULT_PT_FIRE)
               end
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_DSTW then
               sim.partProperty(i, "type", elem.DEFAULT_PT_HYGN)
               sim.partProperty(r, "type", elem.DEFAULT_PT_FIRE)
               end
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_BUBW then
               sim.partProperty(i, "type", methane)
               sim.partProperty(r, "type", elem.DEFAULT_PT_FIRE)
               end
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_PHOT then
               sim.partProperty(i, "type", elem.DEFAULT_PT_ELEC)
               sim.partProperty(r, "type", elem.DEFAULT_PT_RBDM)
               end
            if sim.partProperty(r, "type") == elem.DEFAULT_PT_OXYG then
               sim.partProperty(i, "type", elem.DEFAULT_PT_ELEC)
               sim.partProperty(r, "type", elem.DEFAULT_PT_RBDM)
               end
     end
    end 

--TUNGSTEN CARBIDE--
elem.property(elements.DEFAULT_PT_ETRD, "Name", "W6C")
elem.property(elements.DEFAULT_PT_ETRD, "Description", "Tungsten Carbide. Used as electrode, hard as DMND.")

--TUNGSTEN FORMS TUNGSTEN CARBIDE--
    local function wtow6cUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then --1) TUNG in contact with C2H2 forms W6C--
            if sim.partProperty(r, "type") == elem.KEV_PT_C2H2 and math.random(1,10) == 2 then
               sim.partProperty(i, "type", elem.KEV_PT_CO)
               sim.partProperty(r, "type", elem.DEFAULT_PT_ETRD)
               end  --2) TUNG in contact with BCAR forms W6C--
            if sim.partProperty(r, "type") == elem.KEV_PT_BCAR and math.random(1,50) == 2 then
               sim.partProperty(i, "type", elem.KEV_PT_CO)
               sim.partProperty(r, "type", elem.DEFAULT_PT_ETRD)
               end
     end
    end

--TITANIUM TO TITANIUM CARBIDE--
    local function titoticUpdate(i, x, y, s, nt)
    r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
     if r~= nil then
           if sim.partProperty(r, "type") == elem.KEV_PT_CH4 and math.random(1,240) == 1 then
              sim.partProperty(i, "type", elem.KEV_PT_TIC)
              sim.partProperty(r, "type", elem.DEFAULT_PT_HYGN)
              tpt.create(x+math.random(-1,1), y+math.random(-1,1), "oxyg")
              tpt.create(x+math.random(-1,1), y+math.random(-1,1), "hygn")
              end
     end
    end 

elem.property(elem.KEV_PT_N2, "Update", nUpdate)
elem.property(elem.KEV_PT_N2O, "Update", n2oUpdate)
elem.property(elem.KEV_PT_O3, "Update", o3Update)
elem.property(elem.KEV_PT_NH3, "Update", nh3Update)
elem.property(elem.KEV_PT_CH3NO, "Update", ch3noUpdate)
elem.property(elem.KEV_PT_CH4, "Update", ch4Update)
elem.property(elem.KEV_PT_CO, "Update", coUpdate)
elem.property(elem.KEV_PT_N2H4, "Update", n2h4Update)
elem.property(elem.KEV_PT_R32, "Update", r32Update)
elem.property(elem.KEV_PT_S2O, "Update", s2oUpdate)
elem.property(elem.KEV_PT_CL, "Update", clUpdate)
elem.property(iodinevapor, "Update", iodvUpdate)
elem.property(elem.KEV_PT_H2O2, "Update", h2o2Update)
elem.property(elem.DEFAULT_PT_ACID, "Update", hi3Update)
elem.property(elem.KEV_PT_H2SO4, "Update", h2so4Update)
elem.property(elem.KEV_PT_HCL, "Update", hclUpdate)
elem.property(elem.KEV_PT_HNO3, "Update", hno3Update)
elem.property(elem.KEV_PT_C7H8, "Update", c7h8Update)
elem.property(elem.KEV_PT_NAOH, "Update", naohUpdate)
elem.property(iodine, "Update", iodineUpdate)
elem.property(elem.KEV_PT_MUD, "Update", mudUpdate)
elem.property(elem.KEV_PT_KNO3, "Update", kno3Update)
elem.property(elem.KEV_PT_AL2O3, "Update", al2o3Update)
elem.property(elem.KEV_PT_NCL3, "Update", ncl3Update)
elem.property(elem.KEV_PT_S, "Update", sUpdate)
elem.property(elem.KEV_PT_ANFO, "Update", anfoUpdate)
elem.property(elem.KEV_PT_NI3, "Update", ni3Update)
elem.property(elem.KEV_PT_BGUN, "Update", bgunUpdate)
elem.property(elem.KEV_PT_NH4O3, "Update", nh4o3Update)
elem.property(elem.KEV_PT_C2H2, "Update", c2h2Update)
elem.property(elem.KEV_PT_DIRT, "Update", dirtUpdate)
elem.property(elem.DEFAULT_PT_STNE, "Update", stonetorockUpdate)
elem.property(elem.KEV_PT_ROCK, "Update", rockUpdate)
elem.property(elem.KEV_PT_CMNT, "Update", cementUpdate)
elem.property(elem.KEV_PT_BGPH, "Update", bgraphiteUpdate)
elem.property(elem.KEV_PT_BCAR, "Update", bcarbonoUpdate)
elem.property(elem.KEV_PT_CAC2, "Update", cac2Update)
elem.property(elem.DEFAULT_PT_CNCT, "Update", limestoneUpdate)
elem.property(elem.KEV_PT_SIO2, "Update", sio2Update)
elem.property(elem.KEV_PT_TIO2, "Update", tio2Update)
elem.property(elem.KEV_PT_CUO, "Update", cuoUpdate)
elem.property(elem.KEV_PT_CUSO4, "Update", cuso4Update)
elem.property(elem.KEV_PT_AL, "Update", alUpdate)
elem.property(elem.KEV_PT_AG, "Update", agUpdate)
elem.property(elem.KEV_PT_TURB, "Update", turbineUpdate)
elem.property(elem.DEFAULT_PT_BMTL, "Update", brassUpdate)
elem.property(elem.DEFAULT_PT_RBDM, "Update", rbextrafeaturesUpdate)
elem.property(elem.DEFAULT_PT_TTAN, "Update", titoticUpdate)
elem.property(elem.KEV_PT_GPHT, "Update", graphiteUpdate)
elem.property(elem.KEV_PT_TIC, "Update", ticUpdate)
elem.property(elem.KEV_PT_SIV, "Update", sivUpdate)
elem.property(elem.DEFAULT_PT_TUNG, "Update", wtow6cUpdate)